mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
Fix regression for outputs defined in front matter for term pages
Fixes #12275
This commit is contained in:
parent
90bc1f802a
commit
0750a9ec91
3 changed files with 49 additions and 5 deletions
|
@ -1678,6 +1678,11 @@ func (sa *sitePagesAssembler) assemblePagesStep2() error {
|
|||
if err := sa.applyAggregatesToTaxonomiesAndTerms(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (sa *sitePagesAssembler) assemblePagesStepFinal() error {
|
||||
if err := sa.assembleResources(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -282,11 +282,6 @@ func (h *HugoSites) assemble(ctx context.Context, l logg.LevelLogger, bcfg *Buil
|
|||
return err
|
||||
}
|
||||
}
|
||||
h.renderFormats = output.Formats{}
|
||||
for _, s := range h.Sites {
|
||||
s.s.initRenderFormats()
|
||||
h.renderFormats = append(h.renderFormats, s.renderFormats...)
|
||||
}
|
||||
|
||||
for _, s := range assemblers {
|
||||
if err := s.assemblePagesStep2(); err != nil {
|
||||
|
@ -296,9 +291,16 @@ func (h *HugoSites) assemble(ctx context.Context, l logg.LevelLogger, bcfg *Buil
|
|||
|
||||
h.renderFormats = output.Formats{}
|
||||
for _, s := range h.Sites {
|
||||
s.s.initRenderFormats()
|
||||
h.renderFormats = append(h.renderFormats, s.renderFormats...)
|
||||
}
|
||||
|
||||
for _, s := range assemblers {
|
||||
if err := s.assemblePagesStepFinal(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -646,3 +646,40 @@ WordCount: {{ .WordCount }}
|
|||
b.AssertFileContent("public/outputs-empty/index.html", "HTML:", "Word1. Word2.")
|
||||
b.AssertFileContent("public/outputs-string/index.html", "O1:", "Word1. Word2.")
|
||||
}
|
||||
|
||||
func TestOuputFormatFrontMatterTermIssue12275(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
files := `
|
||||
-- hugo.toml --
|
||||
disableKinds = ['home','page','rss','section','sitemap','taxonomy']
|
||||
-- content/p1.md --
|
||||
---
|
||||
title: p1
|
||||
tags:
|
||||
- tag-a
|
||||
- tag-b
|
||||
---
|
||||
-- content/tags/tag-a/_index.md --
|
||||
---
|
||||
title: tag-a
|
||||
outputs:
|
||||
- html
|
||||
- json
|
||||
---
|
||||
-- content/tags/tag-b/_index.md --
|
||||
---
|
||||
title: tag-b
|
||||
---
|
||||
-- layouts/_default/term.html --
|
||||
{{ .Title }}
|
||||
-- layouts/_default/term.json --
|
||||
{{ jsonify (dict "title" .Title) }}
|
||||
`
|
||||
|
||||
b := Test(t, files)
|
||||
|
||||
b.AssertFileContent("public/tags/tag-a/index.html", "tag-a")
|
||||
b.AssertFileContent("public/tags/tag-b/index.html", "tag-b")
|
||||
b.AssertFileContent("public/tags/tag-a/index.json", `{"title":"tag-a"}`) // failing test
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue