[IMP] conf: add sitemap generation

Use sphinx-sitemap library to generate the sitemap
Requires at least sphinx-sitemap 1.1.0
This commit is contained in:
Martin Trigaux 2019-12-26 14:22:57 +01:00
parent 40f1536166
commit 8a018f8de7
2 changed files with 9 additions and 1 deletions

View File

@ -33,6 +33,7 @@ extensions = [
'odoo', 'odoo',
'demo_link', 'demo_link',
'embedded_video', 'embedded_video',
'sphinx_sitemap'
'github_link', 'github_link',
'html_domain', 'html_domain',
'redirects', 'redirects',
@ -308,6 +309,8 @@ github_project = 'documentation-user'
# Where are stored the localisations files # Where are stored the localisations files
locale_dirs = ['locale/'] locale_dirs = ['locale/']
i18n_url_scheme = "/{version}/{lang}/{link}"
LANGUAGES = { LANGUAGES = {
'de': 'German', 'de': 'German',
'en': 'English', '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)) (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(',') 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): def canonicalize(app, pagename, templatename, context, doctree):
""" Adds a 'canonical' URL for the current document in the rendering """ Adds a 'canonical' URL for the current document in the rendering

View File

@ -1,2 +1,3 @@
Sphinx>=2.4.0 Sphinx>=2.4.0
Werkzeug==0.14.1 sphinx_sitemap
Werkzeug==0.14.1