Host second sitemap on public URL?

Hi, so I figured out how to generate a second sitemap and Hugo outputs the file to the same directory as sitemap.xml (/public), but when I build the site and visit the URL http://localhost:1313/secondsitemap.xml I get a 404, but when I visit /sitemap.xml, the default map is there. What am I doing wrong here?

Here’s my config:


    baseName = "secondsitemap"
    isPlainText = false
    mediaType = "application/xml"
    notAlternative = true


home = [ "HTML", "secondsitemap" ]
taxonomy = [ "HTML" ]
term = [ "HTML" ]

Put this in config/_default/hugo.toml

home = [ "HTML", "secondsitemap" ]
taxonomy = [ "HTML" ]
term = [ "HTML" ]

That key doesn’t want to be a separate file… not sure why. I’m guessing the restriction is related to the fact that you can also set “outputs” in the front matter of each content file.

This was the right answer but probably not for the reasons you cited. We have very complex Hugo site and we’ve broken out different aspects of our build into different build environments. I had placed this into the outputs for the wrong environment. Your answer helped me figure that out, so thank you!

Thanks for letting me know. I will have to go back and test again, because I couldn’t make that key work as its own file in the default configuration folder.

Also, would you please let me know which version you were testing with?

Disregard. Works fine if one can spell.

└── _default/
    ├── hugo.toml
    ├── ouptuts.toml       <-- moron
    └── outputformats.toml

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.