Using self in sphinx toctree does not include subkeys

I would like myctctree in sphinx to include the main (index.rst) page. The docs assume that the inclusion of an ā€œIā€ will do this, but as other users have noted on stackoverflow, this only includes the main page title, so if depth> 1, the behavior of the main page is different from the linked pages.

I also saw the content directive suggested for this problem, for me it just creates a separate local content list and doesn't help in toctree. I am really looking for a solution that provides consistent behavior in toctree. There is one?

+5
source share
1 answer

Including the literal self simply adds the title of the current document, as you mentioned. However, including the title of the current document, it actually adds it to the tree. For instance,

 .. toctree:: :maxdepth: 2 index 

will lead to the desired result. I am not sure why this is not explicitly stated in the documentation.

0
source

Source: https://habr.com/ru/post/1208514/


All Articles