Cory
Cory

Reputation: 604

How do I add a Table of Contents to every page in my Sphinx Documentation?

I'm trying to replicate how the ToC shows up in the sidebar on this page: http://matplotlib.sourceforge.net/sampledoc/extensions.html

...but I can't find any doc explaining how to or "Show Source" on the template itself.

Here is the template source they use on that tutorial: http://matplotlib.sourceforge.net/sampledoc/custom_look.html

It calls:

{% block sidebar1 %}{{ sidebar() }}{% endblock %}

But that doesn't seem to ToC my custom doc.

Update: To answer my own question, you just have to have sub-sections added to the same page and it will autogenerate those subsections as a ToC.

Upvotes: 2

Views: 1501

Answers (1)

Reinout van Rees
Reinout van Rees

Reputation: 13624

The answer (see the question author's update) is that you only get a ToC in the sidebar if you have sections headings in your page. Without headings, no ToC is necessary according to Sphinx.

Upvotes: 1

Related Questions