-
Notifications
You must be signed in to change notification settings - Fork 324
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
Drop the switcher template URL interpolation, and ask users to provide explicit URLs #600
Comments
This is an interesting idea. I like the simplification/versatility on our side even when the creator pays a little bit more price in terms of manual intervention on the JSON file. @drammock, since you implemented the core of the version switcher, do you have any thoughts on this proposal? |
I have a PR just to demonstrate what this would look like here: #604 Would also love feedback from @tupui . I think the question to answer is whether the benefit we get from decreased flexibility outweighs the cost of asking users to manually provide URLs for each version. In my opinion, it's worth it (and IMO makes this feature more understandable and explicit anyway) |
@choldgraf I would not mind removing the interpolation since it's not helping much. From a user perspective you have to fill out some information and adding this is not really much work (would actually be simpler to explain in the doc I think. This point was a bit troubling). What is important is to retain the ability to specify any form of URL path. |
The url_template configuration option was removed in pydata_sphinx_theme as a result of pydata/pydata-sphinx-theme#600
Context
Currently, we ask users to provide two things for the version switcher: a
name
and aversion
.The documentation is then configured with a URL template like
https://mysite.org/en/version-{version}/
.We then interpolate the URL of each version according to the template.
However, there are a few limitations of this approach:
Proposal: users should give explicit links in the JSON
Instead of interpolating a link structure based on a template, we could just ask users to provide a
url:
key for each entry in the JSON configuration. For example, the above structure would become:Then, when the Dropdown list is built, there isn't any interpolation, it simply generates a dropdown list of links with names.
I think this has a few benefits:
v
bug.It does mean slightly more hand-editing of that JSON configuration, but I think that this won't be too bad for most projects. I assume most will only keep maybe 6-12 versions in there, and even larger numbers of versions won't be hard to hand-edit with modern-day text editors.
An added bonus is that it would then be pretty trivial to generate a language dropdown. You'd simply have a second JSON configuration file, with URLs that corresponded to language versions instead of code versions.
ref: this also relates to a bug that was pointed out in #574 (comment)
The text was updated successfully, but these errors were encountered: