Skip to content

Commit

Permalink
[IMP] conf: add sitemap generation
Browse files Browse the repository at this point in the history
Use sphinx-sitemap library to generate the sitemap
Requires at least sphinx-sitemap 1.1.0
  • Loading branch information
mart-e committed Feb 18, 2020
1 parent a542d9a commit ee5f420
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
'demo_link',
'github_link',
'embedded_video',
'sphinx_sitemap'
]

# Add any paths that contain templates here, relative to this directory.
Expand Down Expand Up @@ -304,6 +305,8 @@
# Where are stored the localisations files
locale_dirs = ['locale/']

i18n_url_scheme = "/{version}/{lang}/{link}"

LANGUAGES = {
'de': 'German',
'en': 'English',
Expand Down Expand Up @@ -407,6 +410,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
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Sphinx<2
Sphinx<2
sphinx_sitemap

0 comments on commit ee5f420

Please sign in to comment.