mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-27 06:00:25 +03:00
Revert "tpl: Rework to handle both text and HTML templates"
Will have to take another stab at this ...
This reverts commit 5c5efa03d2
.
Closes #3260
This commit is contained in:
parent
c97dae40d9
commit
7eb71ee064
31 changed files with 839 additions and 1248 deletions
|
@ -110,29 +110,9 @@ func (p *PageOutput) Render(layout ...string) template.HTML {
|
|||
l, err := p.layouts(layout...)
|
||||
if err != nil {
|
||||
helpers.DistinctErrorLog.Printf("in .Render: Failed to resolve layout %q for page %q", layout, p.pathOrTitle())
|
||||
return ""
|
||||
return template.HTML("")
|
||||
}
|
||||
|
||||
for _, layout := range l {
|
||||
templ := p.s.Tmpl.Lookup(layout)
|
||||
if templ == nil {
|
||||
// This is legacy from when we had only one output format and
|
||||
// HTML templates only. Some have references to layouts without suffix.
|
||||
// We default to good old HTML.
|
||||
templ = p.s.Tmpl.Lookup(layout + ".html")
|
||||
}
|
||||
if templ != nil {
|
||||
res, err := templ.ExecuteToString(p)
|
||||
if err != nil {
|
||||
helpers.DistinctErrorLog.Printf("in .Render: Failed to execute template %q for page %q", layout, p.pathOrTitle())
|
||||
return template.HTML("")
|
||||
}
|
||||
return template.HTML(res)
|
||||
}
|
||||
}
|
||||
|
||||
return ""
|
||||
|
||||
return p.s.Tmpl.ExecuteTemplateToHTML(p, l...)
|
||||
}
|
||||
|
||||
func (p *Page) Render(layout ...string) template.HTML {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue