gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
76.02k stars 7.54k forks source link

Output format parameter ignored if RSS template file name excludes output format identifier #12992

Open jmooring opened 3 weeks ago

jmooring commented 3 weeks ago
hugo.toml ```toml [outputFormats.rss] isPlainText = true ```
layouts/_default/list.xml ```text {{ $s := "
" }} {{ $s }} ```
public/index.xml (expected) ```html
```
public/index.xml (actual) ```html <hr> ```

If I include the output format identifier in the template file name (e.g., layouts/_default/list.rss.xml) I get the expected result.

This may be unique to the isPlainText parameter, or it may affect all output format parameters... not sure.

I'm pretty sure this is unique to the rss output format.

integration test ```go func TestFoo(t *testing.T) { t.Parallel() files := ` -- hugo.toml -- ## disableKinds = ['page','home','section','sitemap','taxonomy','term'] [outputFormats.rss] isPlainText = true [outputs] home = ['rss'] -- layouts/_default/list.rss.xml -- {{ $s := "
" }} {{ $s }} ` b := hugolib.Test(t, files) b.AssertFileContent("public/index.xml", "
") files = strings.ReplaceAll(files, "layouts/_default/list.rss.xml", "layouts/_default/list.xml") b = hugolib.Test(t, files) b.AssertFileContent("public/index.xml", "
") // failing test } ```
bep commented 3 weeks ago

I'm pretty sure this is unique to the rss output format.

I suspect this comes from some history about being backward compatible with rss being both a page kind and a output format.

jmooring commented 3 weeks ago

Understood. This is obviously not a high priority item. I just wanted to make sure we were tracking it somewhere.