mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-30 22:39:58 +02:00
Fix some change detection issues on server reloads
* Fix change detection when .GetPage/site.GetPage is used from shortcode * Fix stale content for GetPage results with short name lookups on server reloads Fixes #7623 Fixes #7624 Fixes #7625
This commit is contained in:
@@ -1538,6 +1538,7 @@ func (s *Site) resetBuildState(sourceChanged bool) {
|
||||
s.init.Reset()
|
||||
|
||||
if sourceChanged {
|
||||
s.pageMap.contentMap.pageReverseIndex.Reset()
|
||||
s.PageCollections = newPageCollections(s.pageMap)
|
||||
s.pageMap.withEveryBundlePage(func(p *pageState) bool {
|
||||
p.pagePages = &pagePages{}
|
||||
@@ -1587,6 +1588,18 @@ func (s *SiteInfo) GetPage(ref ...string) (page.Page, error) {
|
||||
return p, err
|
||||
}
|
||||
|
||||
func (s *SiteInfo) GetPageWithTemplateInfo(info tpl.Info, ref ...string) (page.Page, error) {
|
||||
p, err := s.GetPage(ref...)
|
||||
if p != nil {
|
||||
// Track pages referenced by templates/shortcodes
|
||||
// when in server mode.
|
||||
if im, ok := info.(identity.Manager); ok {
|
||||
im.Add(p)
|
||||
}
|
||||
}
|
||||
return p, err
|
||||
}
|
||||
|
||||
func (s *Site) permalink(link string) string {
|
||||
return s.PathSpec.PermalinkForBaseURL(link, s.PathSpec.BaseURL.String())
|
||||
}
|
||||
|
Reference in New Issue
Block a user