Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-10-17 17:11:00 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-10-18 13:13:13 +0300
commit096f5e19217e985bccbf6c539e1b220541ffa6f6 (patch)
treed73660bd172fe5dffd56ff7407274e4fa1d85b23 /commands/hugo.go
parentba35e69856900b6fc92681aa841cdcaefbb4b121 (diff)
Fix the "page picker" logic in --navigateToChanged
Fixes #9051
Diffstat (limited to 'commands/hugo.go')
-rw-r--r--commands/hugo.go16
1 files changed, 11 insertions, 5 deletions
diff --git a/commands/hugo.go b/commands/hugo.go
index fbe2349a0..4f011a33b 100644
--- a/commands/hugo.go
+++ b/commands/hugo.go
@@ -30,6 +30,8 @@ import (
"syscall"
"time"
+ "github.com/gohugoio/hugo/hugofs/files"
+
"github.com/gohugoio/hugo/common/types"
"github.com/gohugoio/hugo/hugofs"
@@ -1200,12 +1202,16 @@ func partitionDynamicEvents(sourceFs *filesystems.SourceFilesystems, events []fs
func pickOneWriteOrCreatePath(events []fsnotify.Event) string {
name := ""
- // Some editors (for example notepad.exe on Windows) triggers a change
- // both for directory and file. So we pick the longest path, which should
- // be the file itself.
for _, ev := range events {
- if (ev.Op&fsnotify.Write == fsnotify.Write || ev.Op&fsnotify.Create == fsnotify.Create) && len(ev.Name) > len(name) {
- name = ev.Name
+ if ev.Op&fsnotify.Write == fsnotify.Write || ev.Op&fsnotify.Create == fsnotify.Create {
+ if files.IsIndexContentFile(ev.Name) {
+ return ev.Name
+ }
+
+ if files.IsContentFile(ev.Name) {
+ name = ev.Name
+ }
+
}
}