-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Manage multiple versions of documentation #770
Comments
This request came up quite a few times and there are some projects which try to solve it (e.g. this by one of the MkDocs creators) but in my opinion it's not a solved problem. jimporter/mike is a start but after some research I found it relies on JavaScript for version selection - not great. Material strictly follows the rules of progressive enhancement so that core functionality works without JavaScript. If JavaScript is not available, versions cannot be selected. Also adoption seems to be quite low. For this reason I have no intention of supporting the project. |
Also, you could implement versioning on your own using some shell scripts. You could build separate branches or tags of your git repository into separate folders and include a dropdown for version selection within the template. You could generate a Jinja template file which exports all generated versions as a macro. I used this technique to implement localization within Material, see: mkdocs-material/material/partials/language/en.html Lines 1 to 23 in e5069bb
Within your macro you could export a list and then import the generated Jinja template and iterate that list. Importing works like this:
The |
Closing as answered. |
For those who want to do this via As a quick explanation to address the concerns raised above with how mike does things, I chose to use JS to build the version selector to meet a few goals: 1) old docs should link to newer versions; 2) once built, you should never have to rebuild docs for a version; 3) if the built docs are copied somewhere without versioning info, the version selector should go away; and 4) the solution should work on gh-pages (so no fancy server-side stuff). JS is the only way I could come up with that can do all that. Of course, not everyone cares about those goals, so perhaps it makes sense for mike to handle inserting the version selector for all the various MkDocs themes out there... |
Will be great to have native support for jimporter/mike.
The text was updated successfully, but these errors were encountered: