Search code examples
pythonpython-sphinxread-the-docs

Multiple versions in self hosted Sphinx documentation


I am trying to build documentation for a self hosted GitLab project. This documentation will be hosted in GitLab pages, and will have different versions. Thanks to this answer, I figured out how to host multiple versions on GitLab pages.

My problem now is how to access those versions.

I would like to use the ReadTheDocs theme, that seems to have been built with that in mind:

rtd collapsible menu

How can I access and modify that navigation menu? I haven't been able to find anything on the documentation.

(Edit: Just learned the name of that menu is flyout)

If this was not possible, I would like to somehow add a section on the left panel (like html_sidebars on the classic theme), since I already built a script to get links to the versions.

I really just need a way to add a section to the bar.


Solution

  • My solution

    Since @Steve Piercy mentioned in a comment that there is no way to have the flyout in the RTD self-hosted theme, I attempted to personalise the left sidebar to add the version links.

    Unlike the classic theme (with the html_sidebars I mentioned), there seems to be no way to configure what is shown. What you can do is add customised javascript and css. So I created a small script that adds a new unordered list with the links to the versions at the top of the toc.

    I would prefer to follow another approach, since it is hacky and it uses hardcoded css class names (that might change at any point), but it is the only thing that I could come up with and works alright.

    If anyone needs more details on the solution, I can provide them.