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 versioning to the left hand-side menu #19

Open
jmineraud opened this issue Dec 7, 2018 · 1 comment
Open

Add versioning to the left hand-side menu #19

jmineraud opened this issue Dec 7, 2018 · 1 comment

Comments

@jmineraud
Copy link

Hi,
similarly to the languages (in fact, in addition to the languages), it would be cool to have the versioning of the documentation. Any ideas on how to enable this ?

@eine
Copy link
Contributor

eine commented Jan 7, 2020

I this is difficult because not all the information is available when you build a single version. Say you have versions A and B. You build both of them to a subdir, both with a template that accepts a list of strings (["A", "B"]) and displays a drop-down menu (where each item points to a subdir). Then, you upload it to say GitHub Pages. Now you need to build a new version, C. You build it with argument ["A", "B", "C"], and upload it to subdir C in the target gh-pages branch. As a result, it will be possible to go from version C to either A or B, but none of these will be aware of C.

A possible workaround is to rebuild all the versions when a new one is added to the list. However, this is not desirable because each version might require a specific version of hugo and/or the theme.

A different solution is to use a JSON file that contains an updated list of available versions and a some Javascript that generates a menu dynamically. When a new version is added, the JSON file needs to be modified only. This approach is used in https://github.com/buildthedocs/sphinx_btd_theme/blob/24f6805417e2c127f6ffa371906f7cbc95d7c4d2/src/theme.js#L213-L232. The advantage is that, when the JSON file is not found (or JS does not work), the version is shown as a simple element (instead of a menu).

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