sphinx
sphinx copied to clipboard
Make next and previous (global variables) respect toc structure
Considering the following toc for index:
.. toctree::
a
b
where a has:
.. toctree::
a1
a2
and b has:
.. toctree::
b1
b2
Currently, page a2 next has a link to b and b has a previous to a2, however, in some cases, this relation doesn't make sense.
So instead of having these relations:
a<->a1<->a2<->b<->b1<->b2
I would like a configuration variable that would change this relation to
a<->a1<->a2 b<->b1<->b2
My current workaround is to manually add a meta variable, e.g. :firstpage: or :lastpage:, where I want to remove the next and/or the previous button and extend the theme's template to add that logic. But, it requires me to change the files every time I change the structure or order.