On this page

Put the sections in the header

By default the primary sidebar lists the whole site. A site with several large sections can move its top-level pages into the header, and leave the sidebar to the section being read.

Place the sections in the header

  1. Name navbar-nav in navbar_center in html_theme_options in conf.py:

    html_theme_options = {
        "navbar_center": ["navbar-nav"],
    }
    
  2. Build the site.

The header now holds a link to each top-level page of the site’s table of contents, and the link to the section being read is marked. The primary sidebar lists only the pages of that section, with the same toggles and marks as before, and nothing on a page that is in no section, such as the front page. On a narrow window, the drawer lists every header link above the sidebar’s pages.

Named in another list, such as navbar_end, navbar-nav draws the links there and the sidebar keeps the whole site.

Why the sidebar changes

Header links and the sidebar share one table of contents. When the top level is in the header, the sidebar would repeat it, so it shows what is below the current section. A site that wants the header links and a whole-site sidebar names navbar-nav in a list other than navbar_center.