-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
Enhancing the switchers setup #4
Comments
Django hosts their documentation on ReadTheDocs, which provides the whole multiple version management stuff. https://readthedocs.org/projects/django/ There's a custom Sphinx theme for Django's docs, maintained in the same repository: |
@humitos pointed out to me today that Django's RTD-built hosted site is different: https://django.readthedocs.io/en/stable/ |
Hi! The Django documentation is a tricky example to follow because they have some custom configuration that is not easy to get access to. If you follow the instructions from their README you will get an output similar to the one hosted on RTD: dark green background, yellow links, and small font --which is not the one deployed at https://docs.djangoproject.com/ Honestly, I don't know how they build the docs deployed as their official documentation.
Read the Docs uses |
Solution 2I understand now, how RTD generates their version switchers, they inject all known versions in sphinx's conf.py then use it in the theme. I like it because there's no javascript involved at runtime to display the page, but we can't easily do it as we can't cleanly modify The only way we can pass things to the HTML templates is by using
and in the theme something like:
(yes there's a missing piece: the "currently selected version"), pros:
cons:
|
pinging @obulat that may be interested in this topic. |
There's more interesting stuff too! If you're using a theme that RTD doesn't know about, then it still will embed JS to inject a version selector. See the discussion at pradyunsg/sphinx-basic-ng#12 and compare https://pradyunsg.me/furo to https://pip.pypa.io/ to see what's different on RTD hosted sites (ads and version selector). |
It looks like an hybrid between the two first solutions, let's call it solution 3:
As we do have control on our theme, I don't think doing it in JS is better than doing it in HTML, so I feel solution 2 is cleaner (no runtime redraw). For the moment I feel that solution 2 is the best. |
Yea, I agree. The RTD embed JS is smart-ish, so if we do the right things in the template, we can prevent a redraw if we're building on RTD. The "big" question that I don't know the answer to is what the effort looks like for porting our existing docs to RTD, and what we'd need the RTD setup to look like. |
This is a thread about enhancing the switchers setup, I do understand that the way we build our switchers may ease or may make harder a possible switch to RTD, but there's no decision about porting to RTD yet. I'm opening a dedicated issue for this. => #5 |
Yes and no 😄 The flyout is built statically but it's then modified via JS when the page loads. This is because the active versions, translations, and others may have changed since the docs were built. JS hit the endpoint Theme authors will have more control over how the flyout is generated once we make some decisions in readthedocs/readthedocs.org#8052 and implement that solution. |
Haha now I'm lost again... So RTD solution looks like Solution 1 but with providing HTML, not a list of versions and it does not need to touch conf.py?
Make sense! I'm adding it to pros and cons of proposed solutions. |
I am sorry I can't add anything to this discussion at the moment, I feel kind of lost here :) |
Maybe the confusion here is that we are using RTD to refer to different things. We have Read the Docs the building/hosting platform (https://readthedocs.org) and
When using I hope this clarifies.
|
Currently the contributions to python-docs-theme are made hard because of the language and version switchers.
I made review a bit easier by adding a github action to build the doc and provide it as a built artifact, so reviewers can just download and test locally.
But still the enhancement of the doc is made hard, for example python/python-docs-theme#46 has been slowed down because of this (sry @obulat).
Solution 1
I once had an idea to enhance the situation: we could provide an "API" on the form of a simple .js file at the root of docs.python.org listing the available versions and languages.
pros:
version.js
file and have no switchers.version.js
file).cons:
/{LANG}/{VERSION}/
with the language being optional, defaulting toenglish
.Other ideas, and feedback welcome.
cc @pradyunsg @obulat
The text was updated successfully, but these errors were encountered: