8000 [MERGE] forward port from 11.0 to 12.0 · dep-odoo/documentation-user@d6ea0b5 · GitHub
[go: up one dir, main page]

Skip to content

Commit d6ea0b5

Browse files
committed
[MERGE] forward port from 11.0 to 12.0
2 parents 255596e + 47d2aed commit d6ea0b5

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