From ad2e3e614696e098cb4ab1791cb402adaa16d033 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 7 Sep 2020 12:44:48 +0200 Subject: sphinx: Add support for multiple docs version Enhance the sphinx experience/nagivation with: * Remove the pointless looking parts of breadcrumb navigtation * Add a document type switcher to the breadcrumb navigation * Add a version selection switch to the breadcrumb navigation (From yocto-docs rev: 1823624bdb9ea002d44c9e6d0fd4cd662bff36ad) Signed-off-by: Richard Purdie --- documentation/conf.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'documentation/conf.py') diff --git a/documentation/conf.py b/documentation/conf.py index 546ca723a9..66af9fa060 100644 --- a/documentation/conf.py +++ b/documentation/conf.py @@ -12,18 +12,25 @@ # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # -# import os -# import sys -# sys.path.insert(0, os.path.abspath('.')) - +import os +import sys import datetime +current_version = "dev" + +# String used in sidebar +version = 'Version: ' + current_version +if current_version == 'dev': + version = 'Version: Current Development' +# Version seen in documentation_options.js and hence in js switchers code +release = current_version + + # -- Project information ----------------------------------------------------- project = 'The Yocto Project' copyright = '2010-%s, The Linux Foundation' % datetime.datetime.now().year author = 'The Linux Foundation' - # -- General configuration --------------------------------------------------- # to load local extension from the folder 'sphinx' @@ -96,4 +103,5 @@ html_context = { 'css_files': [ '_static/theme_overrides.css', ], + 'current_version': current_version, } -- cgit v1.2.3-54-g00ecf