Constructing a sitemap for Sphinx#

Last Updated on 2021-08-20

Additional Packages#

sphinx-sitemap:

poetry add sphinx-sitemap

Example of conf.py configuration#

conf.py:

# 以下を追記します。
extensions = ['sphinx_sitemap']

html_baseurl = 'https://mtakagishi.tk/'
html_extra_path = ['robots.txt']

Search Engine Crawler Support#

Place robots.txt in the same directory as conf.py.

robots.txt:

User-agent: *
Sitemap: https://mtakagishi.tk/sitemap.xml

test#

For Google Search Console, you can test here. Make sure your sitemap is allowed. https://www.google.com/webmasters/tools/robots-testing-tool