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

Enable user to overwrite "Choose version" as a default in the switcher field #1885

Open
mosc9575 opened this issue Jun 16, 2024 · 2 comments

Comments

@mosc9575
Copy link

This is a feature request, to enable the user to overwrite "Choose version" with a string the user preferes.

In my case I want to show the build version of the docs if no version in the switcher.json matches.

This was the case before 5db8dff was commited.

At the moment the relevant code line is this

Choose version <!-- this text may get changed later by javascript -->

and I suggest to change this line to

{{ theme_switcher.get("version_match_default")|default:"Choose version" }}  <!-- this text may get changed later by javascript -->

so the user can define his personal default value in the conf.py by adding version_match_default to the switcher settings.

For example this should be possible.

  "switcher": {
      "json_url": json_url,
      "version_match_default":  "3.2.1rc",
      "version_match": version_match,
  }
@mosc9575 mosc9575 changed the title Enable user to "Choose version" as a default in the switcher field Enable user to overwrite "Choose version" as a default in the switcher field Jun 16, 2024
@drammock
Copy link
Collaborator

If the switcher says "choose version" it indicates that something went wrong in determining what version of the docs are currently being viewed (and matching that up with a corresponding entry in the switcher JSON array). In other words, it's a "graceful failure mode" so that the intent of the dropdown is still clear. I'd rather not make it possible to have the switcher appear as if it detected the version but have it actually display something (possibly) inaccurate.

Can you check the Javascript console of your browser when your site is loaded, to see if:

  • some other JS error is preventing the version detection from running, or
  • there's an error in the version detection itself, or
  • check your JSON to make sure the entries there are correct?

@mosc9575
Copy link
Author

I know, that "Choose version" shows up, if no version match can be found in the switcher.json . The original post comes from bokeh #13477. In an earlier version, the default wasn't "Choose version" but the "dev"-version.

At the moment we have to update the switcher.json for each development version, if we want the old behavior. This is somehow annoying. And after an release the latest dev versions can still be found on the web because they arn't removed, but the switcher.json will not have an entry for each older dev version. This means, it will display "Choose version" again.

In this issue I want to set the default by hand, if this is possible.

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

No branches or pull requests

2 participants