python-sphinxtoctree

How to remove repeating "toc" from the bottom of the index page in sphinx?


Here's my index.rst:

Welcome to the documentation!
=============================

.. include:: readme.rst

.. _INTRODUCTION::
.. toctree::
   :maxdepth: 1
   :caption: Introduction

   readme

.. toctree::
   :maxdepth: 1
   :caption: Contents:

   gazetimation


Indices and tables
==================

* :ref:`genindex`

Here what I'm getting:

enter image description here

How do I get rid off the repeating toc below the author section?


Solution

  • Use the :hidden: option for toctree.

    You can also give a “hidden” option to the directive, like this:

    .. toctree::
        :hidden:
    
        doc_1
        doc_2
    

    This will still notify Sphinx of the document hierarchy, but not insert links into the document at the location of the directive – this makes sense if you intend to insert these links yourself, in a different style, or in the HTML sidebar.