Search code examples
directorypython-sphinxglobread-the-docstoctree

Sphinx Documentation with different separated subjects


I'm trying to build kind of a dashboard in the index with one tile per subject. Each subject will later have its own folder in source with it's own md files.

I want each subject to be disconnected to the others. So the previous button should no go to another subject.

The structure should be something like this: enter image description here First there is an overview with all subjects, then there is a subpage with one toctree per subject and then each document has its own normal view.

Does anyone have an idea how I would go about it?

Currently I build the index like that, but this doesn't separate the files:

.. toctree::
   :maxdepth: 1
   :name: mastertoc
   :caption: Example Files:
   :glob:

   introduction
   examples

.. toctree::
   :maxdepth: 1
   :name: Subject1
   :caption: Subject1:
   :glob:

   Subject1/*

.. toctree::
   :maxdepth: 1
   :name: Subject2
   :caption: Subject2:
   :glob:

   Subject2/*

Solution

  • If I understand your request, you want to have an index page for each subject, too. We do that for Pyramid in a couple of places, like so:

    docs/index.rst

    .. toctree::
       :maxdepth: 1
       :glob:
    
       api/index
       api/*
    

    docs/api/index.rst

    .. toctree::
       :maxdepth: 1
       :glob:
    
       *
    

    Here it is in action:

    https://docs.pylonsproject.org/projects/pyramid/en/latest/#api-documentation

    The first link goes to:

    https://docs.pylonsproject.org/projects/pyramid/en/latest/api/index.html