diff --git a/Makefile b/Makefile index d247101a63b..7f8dc5c1026 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,7 @@ help: multiversion: Makefile sphinx-multiversion $(OPTS) "$(SOURCE)" build/html @echo "" > build/html/index.html + python3 make_sitemapindex.py .PHONY: help Makefile multiversion %: Makefile diff --git a/conf.py b/conf.py index 65568bc2e6f..c9394647332 100644 --- a/conf.py +++ b/conf.py @@ -73,7 +73,16 @@ # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -extensions = ['sphinx.ext.intersphinx', 'sphinx_tabs.tabs', 'sphinx_multiversion', 'sphinx_rtd_theme', 'sphinx.ext.ifconfig', 'sphinx_copybutton', 'sphinx.ext.graphviz'] +extensions = [ + 'sphinx.ext.graphviz', + 'sphinx.ext.ifconfig', + 'sphinx.ext.intersphinx', + 'sphinx_copybutton', + 'sphinx_multiversion', + 'sphinx_tabs.tabs', + 'sphinx_rtd_theme', + 'sphinx_sitemap', +] # Intersphinx mapping diff --git a/make_sitemapindex.py b/make_sitemapindex.py new file mode 100644 index 00000000000..b98dba07c93 --- /dev/null +++ b/make_sitemapindex.py @@ -0,0 +1,17 @@ +from xml.etree.ElementTree import Element, SubElement, ElementTree +from conf import distro_full_names, html_baseurl + + +def make_sitemapindex(sitemap_file): + + sitemapindex = Element('sitemapindex') + sitemapindex.set('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9') + for distro in distro_full_names.keys(): + node = SubElement(sitemapindex, 'sitemap') + SubElement(node, 'loc').text = f'{html_baseurl}/{distro}/sitemap.xml' + + ElementTree(sitemapindex).write(sitemap_file, encoding='utf-8', xml_declaration=True) + +if __name__ == '__main__': + sitemap_file = 'build/html/sitemap.xml' + make_sitemapindex(sitemap_file) diff --git a/requirements.txt b/requirements.txt index e79f8b3f3e1..4d95bd155b5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,4 +5,5 @@ sphinx sphinx-copybutton sphinx-multiversion sphinx-rtd-theme +sphinx-sitemap sphinx-tabs