diff --git a/conf.py b/conf.py index e46c42a..70ab042 100644 --- a/conf.py +++ b/conf.py @@ -6,6 +6,7 @@ # full list see the documentation: # http://www.sphinx-doc.org/en/master/config +import os from pathlib import Path import sys @@ -90,6 +91,15 @@ # # html_theme_options = {} +# Define the canonical URL if you are using a custom domain on Read the Docs +html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "") + +# Tell Jinja2 templates the build is running on Read the Docs +if os.environ.get("READTHEDOCS", "") == "True": + if "html_context" not in globals(): + html_context = {} + html_context["READTHEDOCS"] = True + # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css".