gohugoio / hugo

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

layouts/sitemap.xml first character gets substituted #7400

Closed lorcalhost closed 4 years ago

lorcalhost commented 4 years ago

Describe the bug

When a custom sitemap.xml file is present in /layouts/ the generated sitemap.xml files have the first character (<) substituted with &lt;

To Reproduce

Steps to reproduce the behavior:

  1. Create a custom sitemap.xml file in the /layouts/ directory
  2. Run command hugo to build the site
  3. See first character of newly generated sitemap.xml files

Expected behavior

layouts/sitemap.xml 's content is copied in every built sitemap.xml file without the first character being corrupted

Technical details:

Using theme Academic

bep commented 4 years ago

This is a quirk with Go's templates, and I don't think you will convince them that it's a bug.

See this for a workaround:

https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/_default/sitemap.xml#L1

lorcalhost commented 4 years ago

Thanks for the workaround @bep

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.