[ADD] conf: add sitemap generation

Requires jdillard/sphinx-sitemap@6d5e7b4aeb
This commit is contained in:
Martin Trigaux 2021-07-20 09:04:45 +02:00
parent afdd438818
commit d847b19180
2 changed files with 9 additions and 0 deletions

View File

@ -111,6 +111,9 @@ extensions = [
# Strange html domain logic used in memento pages # Strange html domain logic used in memento pages
'html_domain', 'html_domain',
# Sitemap generation
'sphinx_sitemap',
] ]
if odoo_dir_in_path: if odoo_dir_in_path:
# GitHub links generation # GitHub links generation
@ -247,6 +250,11 @@ def setup(app):
app.connect('html-page-context', _generate_alternate_urls) app.connect('html-page-context', _generate_alternate_urls)
if app.config.language == "en":
app.config.sitemap_url_scheme = "{version}{link}"
else:
app.config.sitemap_url_scheme = "{version}{lang}{link}"
def _generate_alternate_urls(app, pagename, templatename, context, doctree): def _generate_alternate_urls(app, pagename, templatename, context, doctree):
""" Add keys of required alternate URLs for the current document in the rendering context. """ Add keys of required alternate URLs for the current document in the rendering context.

View File

@ -4,3 +4,4 @@ pygments-csv-lexer~=0.1
pysass~=0.1.0 pysass~=0.1.0
sphinx~=3.0 sphinx~=3.0
werkzeug==0.14.1 werkzeug==0.14.1
sphinx_sitemap==2.2.0