jdillard / sphinx-sitemap

Sphinx extension to generate a multi-lingual, multi-version sitemap for HTML builds
https://sphinx-sitemap.readthedocs.io/en/latest/index.html
MIT License
55 stars 21 forks source link

Missing slash in sitemap URL scheme when upgrading from sphinx-sitemap 2.2 to 2.3 #60

Open andersfagerli opened 1 year ago

andersfagerli commented 1 year ago

Hi!

I was on Sphinx<5 and sphinx-sitemap==2.2 and updated my project dependencies to Sphinx>5 and sphinx-sitemap>2.2. When I did so, I noticed that the URLs generated in sitemap.xml where missing a backslash before {lang}, which made the URLs incorrect. See the picture below for the diff: bilde

I can solve this by setting sitemap_url_scheme = "/{lang}{version}{link}", but that doesn't look like a good solution to me. Do you know if there is any other source of error here, possibly within sphinx-sitemap? I've seen https://sphinx-sitemap.readthedocs.io/en/latest/advanced-configuration.html, but this error appears when just changing between sphinx-sitemap 2.2 to 2.3 (and keeping Sphinx>5 constant), so it looks like it was introduced by upgrading sphinx-sitemap.

jdillard commented 1 year ago

It looks like you have Sphinx<5 on the left since you have {html_baseurl}/404.html on the left and {html_baseurl}en/404.html on the right. I don't see any code changes between 2.2 and 2.5 that look like they would change the behavior.

The {html_basurl} gets a forward slash automatically added here, so I'm guessing something might be happening with using the plus operator? (I need to convert to using format)

I don't have an immediate answer as to what is going on, I'll have to test some more.

andersfagerli commented 1 year ago

Thanks! I'll keep sitemap_url_scheme = "/{lang}{version}{link} for now, although I suspect this might break down the line.