Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the switcher to change versions and locales. #1

Merged
merged 1 commit into from
Mar 25, 2021

Conversation

xxr3376
Copy link
Member

@xxr3376 xxr3376 commented Mar 14, 2021

Create a simple version switcher to change versions and locales.

Features

  • User can enable version switch feature by setting theme_use_version_switch=True and set theme_version_switch_json_url = "/versions.json", then you will get an nicely dropdown menu that render everything from /versions.json
  • User can enable locale dropdown as well by enable theme_version_switch_enable_locale
    • different locales may have different versions (I believe this will happen frequently due to translation progress)
    • If the current version doesn't exist in the target locale, it will redirect to the default version in the target locale

TODO

  • Fix page suffix do not match requirements error when pagename is index.html

Questions

  • Can we use ES6 features? Move all javascript into index.js and compiled by webpack, problem solved

@CLAassistant
Copy link

CLAassistant commented Mar 14, 2021

CLA assistant check
All committers have signed the CLA.

@xxr3376 xxr3376 force-pushed the enable-version-switch branch from 20f4ada to c1034f5 Compare March 14, 2021 16:09
@cheekyshibe cheekyshibe force-pushed the enable-version-switch branch from c1034f5 to a35d8f5 Compare March 15, 2021 08:30
@cheekyshibe cheekyshibe deleted the enable-version-switch branch March 15, 2021 08:32
@cheekyshibe cheekyshibe restored the enable-version-switch branch March 15, 2021 08:33
@cheekyshibe cheekyshibe reopened this Mar 15, 2021
@cheekyshibe cheekyshibe changed the title Enable version switch Add the switcher to change versions and locales. Mar 15, 2021
@cheekyshibe cheekyshibe force-pushed the enable-version-switch branch 2 times, most recently from b100d22 to d3b5f1b Compare March 15, 2021 09:29
@xxr3376 xxr3376 force-pushed the enable-version-switch branch from d3b5f1b to ef153f1 Compare March 17, 2021 06:53
@cheekyshibe
Copy link

Please keep the change in d3b5f1b pydata_sphinx_theme/docs-navbar.html (line 46)

      <ul class="navbar-nav">
        <li class="version_switcher nav-item dropdown">
          {%- include "version-switcher.html" %}
        </li>
      </ul>

@xxr3376 xxr3376 force-pushed the enable-version-switch branch from ef153f1 to acd3084 Compare March 17, 2021 11:19
@xxr3376 xxr3376 force-pushed the enable-version-switch branch from acd3084 to eadd8b9 Compare March 17, 2021 14:14
@cheekyshibe
Copy link

cheekyshibe commented Mar 24, 2021

If version.json can not be found. It would be better to hide the version switcher component.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants