Search code examples
python-sphinxread-the-docs

Sphinxdoc/Readthedocs: redirect a "flat" structure to a hierarchical one


I have a Sphinxdoc page on readthedocs with a large number (>1000) of hierarchically sorted pages, https://iraf.readthedocs.io/en/latest/tasks/index.html. My problem is now that I also need to access them in a "flat" structure, i.e.

https://iraf.readthedocs.io/en/latest/tasks/addstar.html

should redirect to

https://iraf.readthedocs.io/en/latest/tasks/noao/digiphot/daophot/addstar.html

How could one do this? The exact URL does not matter; important is that there is a need to access the pages just by the name (like addstar in the example). There are a few conflicts (i.e. the same name at different places in the hierarchy), but they could be solved in a pragmatic "take the first one" approach.


Solution

  • The Sphinx extension sphinx-reredirects might do what you want.

    You could also configure Read The Docs through User-defined Redirects.