-
Notifications
You must be signed in to change notification settings - Fork 201
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 ability to embed a readthedocs style version switcher in static sites #596
Comments
Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗 |
I'm also looking for a solution to integrate the sphinx-multiversion with the book theme |
For anyone looking for the integration with sphinx-multiversion. I put together template based on this theme and sphinx-multiversion version listing.
It is not perfect but it might be a base for someone who might be willing to invest a bit of more time than me. |
@agoose77 @choldgraf any chance this could get some love? |
Context
It's often useful to have multiple versions of documentation, and to be able to switch between these easily. The readthedocs theme makes this easy by providing the structure and css to be able to embed a version switcher by providing a versions.html template, which results in the following:
I'm using sphinx-multiversion which provides the HTML context with which to populate this version switcher, however it seems as though it's not possible to inject this template anywhere into the sphinx-book-theme to get a similar result to what readthedocs provides in their template.
I notice that in your own documentation, you have an equivalent version switcher:
However, it doesn't seem to be possible to replicate this using the theme's options, currently.
Proposal
In this issue, I'm proposing adding the features necessary for a user to instantiate the version switcher as demonstrated in your documentation, on their own static website, without using readthedocs.
As far as I can tell, this would mean the addition of the following features:
<div id="rtd-footer-container">
node (currently can only inject into thebd-sidebar__top
orbd-sidebar__bottom
nodes using existing theme options)rst-versions
,rst-badge
,shift-up
,rst-current-version
,rst-other-versions
,rst-current-item
CSS classes. What's missing seems to largely be contained withinbadge_only.css
andreadthedocs-doc-embed.css
(not currently shipped with this theme).readthedocs-doc-embed.js
(not currently shipped with this theme)I've had limited success hacking my way through this by injecting the above template here:
sphinx-book-theme/src/sphinx_book_theme/theme/sphinx_book_theme/layout.html
Line 46 in ea8efee
And adding the aforementioned
.css
and.js
files as static resources (in the_static
folder). However, it hasn't been perfect and I'm still missing the interactivity so I assume the javascript isn't working correctly. Not being particularly familiar with sphinx templating or theming, I'm hoping that the way to get this to work will be relatively obvious to one of the maintainers.Tasks and updates
No response
Related issues
#449
pydata/pydata-sphinx-theme#234
pydata/pydata-sphinx-theme#647
The text was updated successfully, but these errors were encountered: