mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-27 22:09:53 +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:
@@ -201,9 +201,10 @@ type PageMetaProvider interface {
|
||||
Weight() int
|
||||
}
|
||||
|
||||
// PageRenderProvider provides a way for a Page to render itself.
|
||||
// PageRenderProvider provides a way for a Page to render content.
|
||||
type PageRenderProvider interface {
|
||||
Render(layout ...string) template.HTML
|
||||
Render(layout ...string) (template.HTML, error)
|
||||
RenderString(args ...interface{}) (template.HTML, error)
|
||||
}
|
||||
|
||||
// PageWithoutContent is the Page without any of the content methods.
|
||||
|
@@ -371,8 +371,12 @@ func (p *nopPage) RelRef(argsm map[string]interface{}) (string, error) {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
func (p *nopPage) Render(layout ...string) template.HTML {
|
||||
return ""
|
||||
func (p *nopPage) Render(layout ...string) (template.HTML, error) {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
func (p *nopPage) RenderString(args ...interface{}) (template.HTML, error) {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
func (p *nopPage) ResourceType() string {
|
||||
|
@@ -446,7 +446,11 @@ func (p *testPage) RelRefFrom(argsm map[string]interface{}, source interface{})
|
||||
return "", nil
|
||||
}
|
||||
|
||||
func (p *testPage) Render(layout ...string) template.HTML {
|
||||
func (p *testPage) Render(layout ...string) (template.HTML, error) {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
func (p *testPage) RenderString(args ...interface{}) (template.HTML, error) {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user