mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-15 20:44:01 +02:00
Add render template hooks for headings
This commit also * Renames previous types to be non-specific. (e.g. hookedRenderer rather than linkRenderer) Resolves #6713
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
991934497e
commit
423b8f2fb8
@@ -1650,14 +1650,20 @@ var infoOnMissingLayout = map[string]bool{
|
||||
"404": true,
|
||||
}
|
||||
|
||||
type contentLinkRenderer struct {
|
||||
// hookRenderer is the canonical implementation of all hooks.ITEMRenderer,
|
||||
// where ITEM is the thing being hooked.
|
||||
type hookRenderer struct {
|
||||
templateHandler tpl.TemplateHandler
|
||||
identity.Provider
|
||||
templ tpl.Template
|
||||
}
|
||||
|
||||
func (r contentLinkRenderer) Render(w io.Writer, ctx hooks.LinkContext) error {
|
||||
return r.templateHandler.Execute(r.templ, w, ctx)
|
||||
func (hr hookRenderer) RenderLink(w io.Writer, ctx hooks.LinkContext) error {
|
||||
return hr.templateHandler.Execute(hr.templ, w, ctx)
|
||||
}
|
||||
|
||||
func (hr hookRenderer) RenderHeading(w io.Writer, ctx hooks.HeadingContext) error {
|
||||
return hr.templateHandler.Execute(hr.templ, w, ctx)
|
||||
}
|
||||
|
||||
func (s *Site) renderForTemplate(name, outputFormat string, d interface{}, w io.Writer, templ tpl.Template) (err error) {
|
||||
|
Reference in New Issue
Block a user