Customizing

The following code snippets can be set in conf.py to customize the appearance of your docs.

Show Date Last Updated

This is a built-in Sphinx feature which will show the date the docs were last rendered in the footer of your docs. Format strings for Python’s strftime() are valid here. To disable, set to None

html_last_updated_fmt = "%b %d, %Y"

Custom Fonts & CSS

The theme ships with Adobe’s Source Sans and Source Code Pro fonts. You can change these, or any other style of the docs, with a custom CSS file.

Enable custom static files in conf.py:

# These folders are copied to the documentation's HTML output.
html_static_path = ["_static"]

# These paths are either relative to html_static_path
# or fully qualified paths (eg. https://...).
html_css_files = ["custom.css"]

Then in your _static/custom.css file, import a font and override the relevant rules:

/* Import from Google Fonts, a CDN, or files in your _static folder.
   This Google Fonts import provides its own `@font-face` CSS;
   if providing your own font files, you'll also need to
   provide your own `@font-face` code. */
@import url("https://fonts.googleapis.com/css2?family=Roboto");

/* Main font used throughout the docs. */
body {
  font-family: "Roboto", sans-serif;
}

/* Code snippets. */
pre, code, kbd, samp {
  font-family: "Courier New", monospace;
}

Customize the Sidebar

To change the contents of the sidebar, create a custom HTML template and specify it in conf.py. For example, let’s add a link to sponsor your project below the table of contents tree:

# Add any relative paths that contain templates.
templates_path = ["_templates"]

# Custom sidebar templates, must be a dictionary that maps document names
# to template names. "**" will apply the templates to all pages.
# The theme default is just searchbox and globaltoc.
html_sidebars = {"**": [
    "searchbox.html",
    "globaltoc.html",
    "custom.html",    # Your template here
]}

Then in _templates/custom.html:

<p>
  Sponsor my project!
  <a href="http://example.com">Here's the link</a>
</p>

Read more about customizing the sidebar in Sphinx