1

I am trying to have the TOC show up in all my pages. My set up is pretty simple. In the index.rst, I have

Installation
============

Scripting
=========


.. toctree::
:maxdepth: 2
:caption: Contents:

class ASAT
""""""""""
.. toctree::
    :maxdepth: 2

    asat

    more class ...

and in the other pages, I have:

class asat.SomeClass
"""""""""""""""""""""
.. autoclass:: modeule.SomeClass
    :members:

    .. automethod:: __init__

In order for the TOC to appear, I changed conf.py to reflect:

html_sidebars = {
    '**': [
        'globaltoc.html',
        'relations.html',
        'searchbox.html'
    ]
}

But in doing so, none of the nested stuff from index.rst is showing up in any of the TOCs. Here is a screenshot of what it looks like:

Imgur

How can I get the original/normal TOC from alabaster to appear in all my pages?

bad_coder
  • 11,289
  • 20
  • 44
  • 72
securisec
  • 3,435
  • 6
  • 36
  • 63

1 Answers1

3

According to the installation docs, you need to add navigation.html to the setting.

html_sidebars = {
    '**': [
        'about.html',
        'navigation.html',
        'relations.html',
        'searchbox.html',
        'donate.html',
    ]
}

If you are using a variant of Alabaster, consult their documentation.

EDIT:

I just noticed that your reStructuredText syntax is incorrect. You need to indent the parameters for toctree.

.. toctree::
    :maxdepth: 2
    :caption: Contents:
Steve Piercy
  • 13,693
  • 1
  • 44
  • 57
  • that mostly solves the issue. Now the TOC appears for the individual pages, but not that of the index or any other pages besides on the main page. – securisec Jul 04 '18 at 16:57
  • 1
    Most likely due to the index page being generated before. You can trigger a rebuild of a specific file by deleting it from the build directory, or rebuild the entire docs with `make clean html`. Please let me know if that fixes the last issue. – Steve Piercy Jul 05 '18 at 01:00
  • Ah yes, when i copied it over, i pasted the toc tree incorrectly. My toc is set correctly otherwise sphinx would throw an error. my issue still remains. i tried studying the raw files from the alabaster theme itself, but cant see what he/she is doing differently. while we are on the topic of sphinx, would you be able to address another question? how can i make the methods of a class show up on the side bar while using `.. autoclass`? currently, only the class name shows up on the sidebar – securisec Jul 05 '18 at 14:10
  • At this point, you should create a [MCVE](https://stackoverflow.com/help/mcve) in a repo that we can clone and use to reproduce the issue. For the new issue, you should create a new separate question, but first search through SO for an answer. I've seen this question asked. – Steve Piercy Jul 05 '18 at 20:05
  • Same issue here with the Sphinx autogenerated index.rst. Nothing shows up in the navigation section with alabaster, while rtd works. – TheDiveO Jul 21 '18 at 13:07