Hide sections in toctree?

41 views
Skip to first unread message

Dominick Pastore

unread,
May 14, 2021, 1:49:48 PM5/14/21
to sphinx-users

Hello,

Normally, when you add a "toctree" directive, Sphinx recurses into each file and adds section headings, down to the "maxdepth". I find this to be too much, usability-wise. Intuitively, I would expect one link per page. Having sub-links for all the sections makes the documentation look overly complex and way more overwhelming than it actually is. (Users who are familiar with Sphinx will know that most of the sub-links aren't separate pages, but that's only a small fraction of users.)

The ":titlesonly:" option fixes this, but at the cost of removing section headings from the sidebar when actually on the relevant page (at least when using the Alabaster theme...not sure about others). I don't want to lose those, because they serve as a useful "current page" table of contents.

Is there a way to display a table of contents on the index page while hiding section names? That way, Sphinx stores them and includes them in sidebars, but the main TOC is clean and non-overwhelming.

Thanks,
Nick
Reply all
Reply to author
Forward
0 new messages