From d3b5f1b21b773397e0c3b724d1a3162101bdcb54 Mon Sep 17 00:00:00 2001 From: MegChai Date: Wed, 17 Feb 2021 13:22:04 +0800 Subject: [PATCH] feature: add the switcher to change versions and locales --- pydata_sphinx_theme/docs-navbar.html | 6 + pydata_sphinx_theme/theme.conf | 5 + pydata_sphinx_theme/version-switcher.html | 145 ++++++++++++++++++++++ 3 files changed, 156 insertions(+) create mode 100644 pydata_sphinx_theme/version-switcher.html diff --git a/pydata_sphinx_theme/docs-navbar.html b/pydata_sphinx_theme/docs-navbar.html index 40e36323e8..baea2b4dec 100644 --- a/pydata_sphinx_theme/docs-navbar.html +++ b/pydata_sphinx_theme/docs-navbar.html @@ -43,5 +43,11 @@ {%- block icon_links -%} {%- include "icon-links.html" with context -%} {%- endblock %} + + diff --git a/pydata_sphinx_theme/theme.conf b/pydata_sphinx_theme/theme.conf index 4ec293e7a1..2e7054f94b 100644 --- a/pydata_sphinx_theme/theme.conf +++ b/pydata_sphinx_theme/theme.conf @@ -21,3 +21,8 @@ search_bar_position = sidebar navigation_with_keys = True show_toc_level = 1 navbar_align = content +use_version_switch = True +version_switch_json_url = /versions.json +version_switch_enable_locale = True +version_switch_locales = zh, en + diff --git a/pydata_sphinx_theme/version-switcher.html b/pydata_sphinx_theme/version-switcher.html new file mode 100644 index 0000000000..a7e3e87c0c --- /dev/null +++ b/pydata_sphinx_theme/version-switcher.html @@ -0,0 +1,145 @@ +{% if theme_use_version_switch == true %} + + + + + +{% endif %}