mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-24 21:56:05 +02:00
output: Rework the base template logic
Extract the logic to a testable function and add support for custom output types. Fixes #2995
This commit is contained in:
@@ -923,10 +923,11 @@ func (p *Page) update(f interface{}) error {
|
||||
p.s.Log.ERROR.Printf("Failed to parse lastmod '%v' in page %s", v, p.File.Path())
|
||||
}
|
||||
case "outputs":
|
||||
outputs := cast.ToStringSlice(v)
|
||||
if len(outputs) > 0 {
|
||||
o := cast.ToStringSlice(v)
|
||||
if len(o) > 0 {
|
||||
// Output formats are exlicitly set in front matter, use those.
|
||||
outFormats, err := output.GetTypes(outputs...)
|
||||
outFormats, err := output.GetFormats(o...)
|
||||
|
||||
if err != nil {
|
||||
p.s.Log.ERROR.Printf("Failed to resolve output formats: %s", err)
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user