-
Notifications
You must be signed in to change notification settings - Fork 47
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
Custom version ordering #124
Comments
The development version of mike 2.0 uses a (hopefully) smarter version-sorting scheme: versions starting with numbers are sorted as usual, but versions that don't start with numbers are now treated as "development versions", and go at the top of the list (in reverse-alphabetical order, since the dropdown sorts from last to first). That should go most of the way to solving your issue here. That said, if you have a version named You might also benefit from specifying the versions of your pages as Of course, the changes in mike 2.0 might not be sufficient for how you want things to look. I don't think I'd want to add extra support in mike itself for customizing the sort order, but since the |
The problem is the leading I agree wholeheartedly with your point of not keeping the patch versions around. However, our project has over 10 years of history and in an effort to be thorough those ended up in the URLs and nobody had the stomach to change all of the links. I will try the latest version and see what happens. If it doesn't do what we want then I will write a little script order them how we would like to see it. Thanks very much for your help. |
If you set up aliases, you shouldn't need to worry about invalidating old links. You could have, say, Maybe there's an argument for version specifiers like |
Ok, as of 8440141, With that fixed, I think that's all that mike can really do to help with this, so more-esoteric scenarios will probably require a bit of post-processing. (It would be an interesting experiment to see if you could write a new MkDocs plugin that performs this post-processing in a clean way, but I'm not sure I have time to try that out myself.) |
Wow, thank you! I will try it out asap! |
Since mike is a plugin, could'n it just allow users to implement their own sorting function? We do the same over at Material for MkDocs, e.g. for slugifying tags or comparing tags for sorting. That would give authors 100% control.
Sorting the |
It could, but I'd prefer to keep options to a minimum if I can help it. My goal is to release mike v2.0 and then call the project "done", aside from the occasional bugfix or compatibility update. I mainly wrote mike to solve this for my personal projects, and it already does considerably more than I need. In this case, a user could post-process the |
Ah yeah, been there, thought that 😅 I was corrected. I guess that's what Open Source is all about. I need to say: many thanks for maintaining mike over the last years by the way, it's a really good and lean versioning implementation! With that said, offering users ways to customize has often been, at least for me, a good escape hatch for further feature requests. |
It's something I might think about further in the future, but my initial goal with mike was for it to be a set of commands that users add their own automation on top of. Increasingly (especially with 2.0), I've moved more of that into the configuration for the plugin, so that it becomes easier to manage without writing wrapper scripts. For a little bit of backstory: I myself never interact with mike directly; I use wrappers on top to automatically manage documentation versions so that I only ever have to run (And thanks for the kind words! Obviously, I like mike, but I'm glad others have gotten value out of it too!) |
Over the years our open source project has accumulated a few idiosyncratic ways of doing things. We recently moved from readthedocs to mike and want to keep our current URL structure but that leads to the ordering in versions.json to be not what we hoped.
Our versions are this:
Understandably, mike orders these versions like this:
This leads to them being rendered in the version selector like that:
Would you accept any patches that implement a custom version ordering? Or should I forget that idea and implement a little GH Action that reorders the file after the commit?
The text was updated successfully, but these errors were encountered: