Add version switcher to Sphinx docs

This commit is contained in:
Ray Speth 2023-08-07 19:32:36 -04:00 committed by Ray Speth
parent 4c89ce5f27
commit 04cc5b459a
2 changed files with 50 additions and 0 deletions

View File

@ -0,0 +1,35 @@
[
{
"name": "3.0 (dev)",
"version": "3.0",
"url": "/documentation/dev/sphinx/html/"
},
{
"version": "2.6.0 (stable)",
"url": "/documentation/docs-2.6/sphinx/html/"
},
{
"version": "2.5.1",
"url": "/documentation/docs-2.5/sphinx/html/"
},
{
"version": "2.4.0",
"url": "/documentation/docs-2.4/sphinx/html/"
},
{
"version": "2.3.0",
"url": "/documentation/docs-2.3/sphinx/html/"
},
{
"version": "2.2.1",
"url": "/documentation/docs-2.2/sphinx/html/"
},
{
"version": "2.1.2",
"url": "/documentation/docs-2.1/sphinx/html/"
},
{
"version": "2.0.2",
"url": "/documentation/docs-2.0/sphinx/html/"
}
]

View File

@ -176,11 +176,26 @@ html_theme = 'pydata_sphinx_theme'
html_theme_options = {
"show_toc_level": 2,
"navbar_center": ["cantera-org-links"],
"navbar_end": ["version-switcher", "theme-switcher", "navbar-icon-links"],
"logo": {
"link": "/index.html",
"alt_text": "Cantera",
},
"primary_sidebar_end": ["numfocus"],
"switcher": {
"json_url": "/documentation/dev/sphinx/html/_static/doc-versions.json",
# "json_url": "https://cantera.org/doc-versions.json",
"version_match": version,
},
"check_switcher": False,
"icon_links": [
{
"name": "GitHub",
"url": "https://github.com/Cantera/cantera",
"icon": "fa-brands fa-square-github",
"type": "fontawesome",
}
],
}
# Add any paths that contain custom themes here, relative to this directory.