8000 [MERGE] forwardport of 10.0 to 11.0 · hamoodeh8889/documentation-user@47d2aed · GitHub
[go: up one dir, main page]

Skip to content
Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 47d2aed

Browse files
committed
[MERGE] forwardport of 10.0 to 11.0
2 parents 64271fc + cd41235 commit 47d2aed

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

conf.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,11 +343,28 @@ def setup(app):
343343
app.connect('html-page-context', analytics)
344344
app.add_config_value('google_analytics_key', '', 'env')
345345

346+
app.connect('html-page-context', versionize)
347+
app.add_config_value('versions', '', 'env')
348+
346349
app.connect('html-page-context', localize)
347350
app.add_config_value('languages', '', 'env')
348351

349352
app.connect('doctree-resolved', tag_toctrees)
350353

354+
def versionize(app, pagename, templatename, context, doctree):
355+
""" Adds a version switcher below the menu, requires ``canonical_root``
356+
and ``versions`` (an ordered, space-separated lists of all possible
357+
versions).
358+
"""
359+
if not (app.config.canonical_root and app.config.versions):
360+
return
361+
362+
context['versions'] = [
363+
(vs, _build_url(app.config.canonical_root, vs, pagename))
364+
for vs in app.config.versions.split(',')
365+
if vs != app.config.version
366+
]
367+
351368
def analytics(app, pagename, templatename, context, doctree):
352369
if not app.config.google_analytics_key:
353370
return

0 commit comments

Comments
 (0)
0