diff options
Diffstat (limited to 'hugolib/page.go')
-rw-r--r-- | hugolib/page.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/hugolib/page.go b/hugolib/page.go index 28ef1e156..ca93bf18b 100644 --- a/hugolib/page.go +++ b/hugolib/page.go @@ -78,6 +78,7 @@ type pageContext interface { posOffset(offset int) text.Position wrapError(err error) error getContentConverter() converter.Converter + addDependency(dep identity.Provider) } // wrapErr adds some context to the given error if possible. @@ -93,6 +94,18 @@ type pageSiteAdapter struct { s *Site } +func (pa pageSiteAdapter) GetPageWithTemplateInfo(info tpl.Info, ref string) (page.Page, error) { + p, err := pa.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 (pa pageSiteAdapter) GetPage(ref string) (page.Page, error) { p, err := pa.s.getPageNew(pa.p, ref) if p == nil { @@ -127,6 +140,10 @@ func (p *pageState) Eq(other interface{}) bool { return p == pp } +func (p *pageState) GetIdentity() identity.Identity { + return identity.NewPathIdentity(files.ComponentFolderContent, filepath.FromSlash(p.Path())) +} + func (p *pageState) GitInfo() *gitmap.GitInfo { return p.gitInfo } |