Configuration#
Core configuration options for quantecon-book-theme. All options are set via
html_theme_options in your conf.py (or _config.yml for Jupyter Book).
Disabling QuantEcon Official Components#
If you are a project using this theme but are not an official QuantEcon project, set the following to remove the QuantEcon logo from the top toolbar and adjust some default color styles:
html_theme_options = {
...
"quantecon_project": False,
...
}
Single-Page Mode#
If your documentation only has a single page:
html_theme_options = {
...
"single_page": True,
...
}
This disables the left navigation bar.
Plugins#
Add custom JavaScript plugins to extend or modify theme features:
html_theme_options = {
...
"plugins_list": ["path-relative-to-config-file.js"],
...
}
Logo Configuration#
Dark mode logo#
Provide a dedicated dark mode variant of your logo. The image must be in
your _static/ directory:
html_theme_options = {
...
"dark_logo": "name-of-dark-logo-image",
...
}
When no dark logo is provided, the theme automatically applies an inversion filter to the site logo.
Sticky Table of Contents#
Enable a fixed right-hand table of contents with scroll spy and auto-expansion:
html_theme_options = {
...
"sticky_contents": True,
...
}
For Jupyter Book projects:
sphinx:
config:
html_theme_options:
sticky_contents: true
Features#
When enabled:
Fixed positioning — the TOC stays visible while scrolling
Active section highlighting — the current section is highlighted
Copy section link — hover over a TOC entry to reveal a copy icon
Back to top button — appears after scrolling down 300px
Auto-expand subsections — subsections expand as you scroll
Disable auto-expansion#
html_theme_options = {
...
"sticky_contents": True,
"contents_autoexpand": False,
...
}
When contents_autoexpand is False, only top-level section names are displayed.
Download Notebook Path#
Specify a custom location for downloadable notebooks (useful for GitHub Pages without a custom URL):
html_theme_options = {
...
"download_nb_path": "https://{{ GitHub Account }}.github.io/{{ repo }}/",
...
}
The default location is /_notebooks/.
Open Graph Metadata#
Generate OpenGraph preview tags by setting your site’s base URL:
html_baseurl = "https://<your-site-baseurl>"