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

Sphinx 6.1.3 error: Sitemap file generates, but with no entries #66

Closed astromatt closed 1 year ago

astromatt commented 1 year ago

I have an error with generating sitemap for my website. Sphinx 6.1.3 (newest) generates sitemap.xml file but without any entries. Unfortunately there is no log info besides:

sphinx-sitemap: sitemap.xml was generated for URL https://python3.info in /home/docs/checkouts/readthedocs.org/user_builds/workshop-python/checkouts/latest/_readthedocs/html/sitemap.xml

In my conf.py I have:

html_baseurl = 'https://python3.info'
sitemap_url_scheme = '{link}'
sitemap_filename = 'sitemap.xml'
sitemap_locales = [None]
html_extra_path = ['robots.txt']

Generated sitemap.xml (yes, that's all file):

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>https://python3.info/</loc>
<lastmod>2023-04-03T23:49:44.379481+00:00</lastmod>
<changefreq>weekly</changefreq>
<priority>1</priority>
</url>

References:

jdillard commented 1 year ago

What are the steps for building the documentation locally?

astromatt commented 1 year ago

To build it locally I use: sphinx-build -a -E -j auto --color -b html {src} {dst} However I haven't done it for a long time. I use CICD exclusively for last couple of years.

On readthedocs they use: python -m sphinx -T -E -b html -d _build/doctrees -D language=en . $READTHEDOCS_OUTPUT/html

astromatt commented 1 year ago

I was frustrated why this is not working, so I wrote my own extension: https://github.com/astromatt/book-python/blob/main/_extensions/sitemap.py

And it was also not working... As it appears Readthedocs generates sitemap on his own. In my case something was wrong and it was almost empty file (index page, but no other entries). So I changed name to sitemap1.xml and it started to work...

References: