Dalton Smith
Dalton Smith

Reputation: 23

Sphinx (RTD Theme) section navigation is not consistent

My issue is hard to convey with words. I'll try the best I can.

Using Sphinx 2.0.0, I have a project with the following "root" toctree. This is the index toctree:

Welcome to FIRST Robotics Documentation
========================================================

.. toctree::
   :maxdepth: 2
   :caption: WPILib Software

   software

.. toctree::
   :maxdepth: 2
   :caption: WPILib Hardware

   hardware

.. toctree::
   :maxdepth: 2
   :caption: Robot Networking

   networking

This works great.

I now have a structure that looks a bit like this:

What the Toctree Looks Like

Now let's use the "software" toctree index page

.. toctree:: 
   :maxdepth: 1

   quick urls here

Getting Started
===============

.. toctree::
   :maxdepth: 1

   docs here

WPILib Overview
===============

.. toctree::
   :maxdepth: 1

   docs here

This gives me a page that looks like this:

screenshot 2

However, the issue is when you begin to navigate into the sub-sub-toctrees. When you go into the "WPILib Overview" section, the top nav-bar shows as "Getting Started", this is reproducible throughout the other sections as well.

Example of an article listed under the wrong section

In the above image, it should show "WPILib Overview" instead of "Getting Started". Unfortunately it does not.

Source code is available publicly at: https://github.com/daltz333/frc-docs Webpage source and problem URL at: https://frc-docs.rtfd.io/en/develop

I can't think of any solution besides breaking every single section into it's own file, which is not an option.

Upvotes: 1

Views: 1930

Answers (1)

Peter Scopes
Peter Scopes

Reputation: 29

You need to set the navigation_depth as a property of html_theme_options in conf.py, i.e.:

# Theme options are theme-specific and customize the look and feel of a theme
# further.  For a list of options available for each theme, see the
# documentation.
html_theme_options = {
    'navigation_depth': 2
}

For more information see their documentation on configuration of theme options.

Upvotes: 1

Related Questions