Add/Remove items from theme sections#
There are a few major theme sections that you can customize to add/remove components, or add your own components. Each section is configured with a list of html templates - these are snippets of HTML that are inserted into the section by Sphinx.
You can choose which templates show up in each section, as well as the order in which they appear. This page describes the major areas that you can customize.
Note
When configuring templates in each section, you may omit the .html
suffix after each template if you wish.
A list of built-in templates you can insert into sections#
Below is a list of built-in templates that you can insert into any section. Note that some of them may have CSS rules that assume a specific section (and will be named accordingly).
icon-links.html
search-field.html
copyright.html
edit-this-page.html
last-updated.html
navbar-icon-links.html
navbar-logo.html
navbar-nav.html
page-toc.html
sidebar-ethical-ads.html
sidebar-nav-bs.html
sphinx-version.html
version-switcher.html
Add your own HTML templates to theme sections#
If you’d like to add your own custom template to any of these sections, you could do so with the following steps:
Create an HTML file in a folder called
_templates
. For example, if you wanted to display the version of your documentation using a Jinja template, you could create a file:_templates/version.html
and put the following in it:<!-- This will display the version of the docs --> {{ version }}
Now add the file to your menu items for one of the sections above. For example:
html_theme_options = { ... "navbar_start": ["navbar-logo", "version"], ... }