Skip to content

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
@chaimode chaimode force-pushed the enable-version-switch branch from c1034f5 to a35d8f5 Compare March 15, 2021 08:30
@chaimode chaimode closed this Mar 15, 2021
@chaimode chaimode deleted the enable-version-switch branch March 15, 2021 08:32
@chaimode chaimode restored the enable-version-switch branch March 15, 2021 08:33
@chaimode chaimode reopened this Mar 15, 2021
@chaimode chaimode changed the title Enable version switch Add the switcher to change versions and locales. Mar 15, 2021
@chaimode chaimode 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
@chaimode
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
@chaimode
Copy link

chaimode 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.

4 participants