Don’t name a folder “sitemap”

I discovered to my surprise today that my Hugo site had no sitemap.xml file. I’ve long had folders named content/sitemap/ and layouts/sitemap/ for the purpose of generating an HTML sitemap, but never saw a problem with that until now regarding the standard, default XML sitemap that Hugo normally creates automatically. Lo and behold, once I renamed those two folders (to content/sitemaphtml/ and layouts/sitemaphtml/, respectively), Hugo once again happily generated sitemap.xml in the /public folder. Perhaps it became confused, somehow. No idea. Anyway, am just passing this along in case it may be helpful.

Out of curiosity, to what path was this published? Also note that this setup worked fine with v0.122.0, so this is a bug.

Is the setup something like this?

content/
└── sitemap/
    └── index.md  <-- front matter: type = sitemap
layouts/
└── sitemap/
    └── single.html

@jmooring Yes, exactly that setup.

I was unable to determine when the issue began, other than checking Google Search Console and noting that it had failed to detect /sitemap.xml in either January or February (until I manually supplied it today, that is); I couldn’t get to reports from 2023, so unfortunately I can’t tell you in which Hugo version it began.

I did search the Hugo GH issues and the Discourse for similar reports about issues with sitemap.xml, especially recently, but found nothing of that nature — although my usage may have been sufficiently non-standard that it wouldn’t have generated any issue reports in the first place.

It worked in v0.122.0. This is a bug.

1 Like

Shall I file the issue, or are you already doing so?

I’ll take care of it; I can provide an integration test at the same time. Please leave this topic unsolved.

1 Like

Will do. Thanks as usual, sir.

1 Like

Incidentally, this link will show you my setup prior to my discovering the sitemap.xml glitch:

1 Like

https://github.com/gohugoio/hugo/issues/12183

1 Like

Fixed in 0.123.7. Thanks, @bep and @jmooring !

1 Like

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