From 8a018f8de7de645f0742873f391320e7216478e3 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Thu, 26 Dec 2019 14:22:57 +0100 Subject: [PATCH] [IMP] conf: add sitemap generation Use sphinx-sitemap library to generate the sitemap Requires at least sphinx-sitemap 1.1.0 --- conf.py | 7 +++++++ requirements.txt | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/conf.py b/conf.py index eee8efbfb..af2746daf 100644 --- a/conf.py +++ b/conf.py @@ -33,6 +33,7 @@ extensions = [ 'odoo', 'demo_link', 'embedded_video', + 'sphinx_sitemap' 'github_link', 'html_domain', 'redirects', @@ -308,6 +309,8 @@ github_project = 'documentation-user' # Where are stored the localisations files locale_dirs = ['locale/'] +i18n_url_scheme = "/{version}/{lang}/{link}" + LANGUAGES = { 'de': 'German', 'en': 'English', @@ -412,6 +415,10 @@ def localize(app, pagename, templatename, context, doctree): (la.split('_')[0] if la != 'en' else 'x-default', _build_url(app.config.canonical_root, (la != 'en' and la or ''), pagename)) for la in app.config.languages.split(',') ] + if not app.config.html_baseurl: + # remove last fragment containing the version + root = '/'.join(app.config.canonical_root.rstrip('/').split('/')[:-1]) + app.config["html_baseurl"] = root def canonicalize(app, pagename, templatename, context, doctree): """ Adds a 'canonical' URL for the current document in the rendering diff --git a/requirements.txt b/requirements.txt index 95726293f..000ca808a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ Sphinx>=2.4.0 -Werkzeug==0.14.1 \ No newline at end of file +sphinx_sitemap +Werkzeug==0.14.1