-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
display banner link to stable docs from latest and old docs #3481
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
Comments
This sounds good to me. |
This seems that was implemented a long time ago (#587 (comment)), I don't know what happened with that feature. |
That's going from old to stable, I'm asking for latest to stable. |
We are running into this same issue with our Wagtail docs wagtail/wagtail#3375 Some people end up viewing the latest and are not sure that it is actually the development version (ie. not stable). |
I'm taking a look at the discussion here and I think there are different cases here that should be considered:
Implementation design?So, I think we need to do several things here to handle all of these cases:
Where all these configs should live?Since this is general to the project itself (*), I think they can't go in the YAML file (at least before we define a general rule for this at readthedocs/readthedocs-build#46) and should be modified using the Admin interface and save some things in the Project model and some others in the Version model (I don't really like this, but I don't see a better option ATM) (*) there are specific messages for specific versions, but if you create a tag How/Where the user set these configs?I'm imagining something under https://readthedocs.org/dashboard//versions/ where all the versions are listed and you can mark a checkbox which will show a text box to introduce the general message for old stable versions plus a checkbox per version that will show a text box for the custom message for that specific version. How are these messages shown in the docs?This should work similarly as it's working right know using the AJAX request to So, probably it worth to create a different endpoint for this instead of using the footer one.
I think this covers all the cases. It sounds that not trivial work is needed to implement it and probably more UX decision are needed also to make it more user friendly. Although I think I didn't miss any use case that we have seen in the past days, I would appreciate that you comment here if your use case is not covered here or there is a mistake in my understanding of any of them. Please, @rtfd/core, can you share your thoughts here? |
This is way too overcomplicated. I'd argue that we should remove this feature, before we try to build such complexity into it. I've already tried in the past to automate "is this version supported?" and it proved impossible to do in a generic way. In particular, setting this per-version seems like way too much overhead, and likely not something that is specifically useful for users. In particular, the version's state will change over time, so it adds a large burden to maintainers. The question we need to answer here is "what value are we providing?" -- I think we mainly need to:
I think the "warn people about a new version" is also prone to a lot of failure cases, as we've seen, so probably that functionality should be removed. People can maintain warnings themselves at the Sphinx level, as I don't think this is a platform feature that we can scale to all projects in a meaningful way. |
Given that the RTD context is documented now, and contains the version information necessary to implement this, that would be fine. It just means you need a custom theme if you want to show it. |
I agree with @ericholscher, but this complexity is the only thing that I found that allows us to manage all these cases (which I consider valid and not crazy --given the examples of Flask and Django)
I'm not very into how to create a custom theme regarding:
After reading this phrase, maybe what we need is to document "How to make a small derivated custom theme to add these types of notes as you need". So, we end up with the generic rule (already implemented and useful to many people) but if it doesn't fit your needs, you can read this article and make it work for your specific case. How complicated it could be to write this kind of guide? and, how complicated it could be to follow this guide for a user that doesn't have ton of experience with programming? |
Extending the RTD theme / template locally isn't particularly complicated, but it's not thoroughly documented on Sphinx's side. I'd recommend not making people do this just to get a dev / old version message. It seems like something that should already be part of the RTD theme since RTD is already doing a lot with the version information. |
It's not a custom theme, it's a simple Sphinx extension that could implement the logic and render it on the pages. The hard part is defining what versions are active/supported/newest. We've had a number of bugs in our tries to do this automatically, so it seems like something that must be manual. I think we could build an opt-in system that let users define which of their versions are supported, but then we still have to define which is the "highest" for the redirect, which again runs into the version comparison problem. I just don't see a way that RTD can provide value here, without having users explicitly define exactly what do to (eg. soft redirect this version to that version) -- and at that point, it would be much better to do in a generic Sphinx extension that can integrate with RTD data, instead of a bunch of additional logic in our codebase to maintain. |
@davidism Can you pointed me to this? I'm interesting on building a sphinx extension at some point. Started a PoC for this at https://github.com/humitos/sphinx-version-warning |
This code parses and adds to the context: https://github.com/pallets/pallets-sphinx-themes/blob/master/pallets_sphinx_themes/versions.py, which is read in this template for the sidebar: https://github.com/pallets/pallets-sphinx-themes/blob/master/pallets_sphinx_themes/pocoo/versions.html, and this one for the banner: https://github.com/pallets/pallets-sphinx-themes/blob/master/pallets_sphinx_themes/pocoo/layout.html It requires passing version information as extra context when building each version. You can see it in action on the Flask docs: http://flask.pocoo.org/docs/dev/quickstart/ There are various things in our docs (not all of it has been extracted to the themes repo) that I may extract into extensions later. |
Just in case that someone else arrives at this issue, I just published a very small sphinx extension that allows project's owner to get a similar behaviour than the one described in this comment: #3481 (comment) There are still work to do to make it more customizable but it's a good starting point: https://github.com/humitos/sphinx-version-warning |
RTD will display a banner when viewing old versions of docs that links to the highest released version. We'd like to display a banner when viewing the latest docs as well, so that users don't try to use features that aren't released yet. For examples, see Flask or Django.
The text was updated successfully, but these errors were encountered: