mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-27 06:00:25 +03: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:
parent
67f3aa72cf
commit
e625088ef5
59 changed files with 2234 additions and 542 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue