mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-29 07:00:31 +03:00
hugolib, commands: Improve live-reload on directory structure changes
This issue is more visible now that we support nested sections. This commit makes operations like pasting new content folders or deleting content folders during server watch just work. Fixes #3570
This commit is contained in:
parent
b39689393c
commit
fe901b8119
4 changed files with 39 additions and 8 deletions
|
@ -322,6 +322,18 @@ func (ps Pages) FindPagePosByFilePath(inPath string) int {
|
|||
return -1
|
||||
}
|
||||
|
||||
func (ps Pages) FindPagePosByFilePathPrefix(prefix string) int {
|
||||
if prefix == "" {
|
||||
return -1
|
||||
}
|
||||
for i, x := range ps {
|
||||
if strings.HasPrefix(x.Source.Path(), prefix) {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
// FindPagePos Given a page, it will find the position in Pages
|
||||
// will return -1 if not found
|
||||
func (ps Pages) FindPagePos(page *Page) int {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue