mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-15 20:44:01 +02:00
Add render template hooks for links and images
This commit also * revises the change detection for templates used by content files in server mode. * Adds a Page.RenderString method Fixes #6545 Fixes #4663 Closes #6043
This commit is contained in:
@@ -54,3 +54,22 @@ func (p *pageForShortcode) TableOfContents() template.HTML {
|
||||
p.p.enablePlaceholders()
|
||||
return p.toc
|
||||
}
|
||||
|
||||
// This is what is sent into the content render hooks (link, image).
|
||||
type pageForRenderHooks struct {
|
||||
page.PageWithoutContent
|
||||
page.TableOfContentsProvider
|
||||
page.ContentProvider
|
||||
}
|
||||
|
||||
func newPageForRenderHook(p *pageState) page.Page {
|
||||
return &pageForRenderHooks{
|
||||
PageWithoutContent: p,
|
||||
ContentProvider: page.NopPage,
|
||||
TableOfContentsProvider: page.NopPage,
|
||||
}
|
||||
}
|
||||
|
||||
func (p *pageForRenderHooks) page() page.Page {
|
||||
return p.PageWithoutContent.(page.Page)
|
||||
}
|
||||
|
Reference in New Issue
Block a user