Read the Docs Sphinx Theme
The `sphinx-rtd-theme` is the official Sphinx theme for Read the Docs, designed to provide an excellent reading experience for documentation users on both desktop and mobile devices. It is widely adopted across many open-source projects. The current version is 3.1.0, and it maintains an active development and release cadence.
Warnings
- breaking Version 3.1.0 (and 2.0.0 onwards) drops support for Sphinx versions older than 6.0. Projects using older Sphinx versions will need to upgrade Sphinx or pin an older `sphinx-rtd-theme` version. Similarly, Python versions older than 3.8 are no longer supported.
- breaking The HTML4 writer is officially deprecated since version 2.0.0 and will throw an error if still configured.
- deprecated The `analytics_id` and `analytics_anonymize_ip` configuration options are deprecated in version 3.1.0. Users should migrate to `sphinxcontrib-googleanalytics` for Google Analytics integration.
- deprecated Defining `html_theme_path` will raise a warning in newer versions of the theme, as it's no longer required for local installations. `extra_css_files` is also deprecated and will be removed in a future version.
- gotcha For search, smooth scrolling, and the flyout menu to function correctly, `sphinx_rtd_theme` must be explicitly declared in the `extensions` list in `conf.py`. This ensures `sphinxcontrib-jquery` is activated.
- gotcha Errors during documentation builds with a new theme are often due to conflicting theme-specific configurations such as `html_sidebars`, `html_theme_path`, or `html_theme_config`.
Install
-
pip install sphinx-rtd-theme
Imports
- html_theme
html_theme = "sphinx_rtd_theme"
Quickstart
# First, create a Sphinx project if you don't have one:
# sphinx-quickstart
# In your project's conf.py file:
# ------------------------------
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
project = 'My Awesome Project'
copyright = '2026, Your Name'
author = 'Your Name'
release = '0.1.0'
extensions = [
'sphinx_rtd_theme'
]
html_theme = "sphinx_rtd_theme"
# To build the documentation (run from your project root):
# -------------------------------------------------------
# make html
# or
# sphinx-build -b html . _build