From 7f7cac7889c146fbf589c6677c4aefa35bb4cbcb Mon Sep 17 00:00:00 2001 From: Dan Foreman-Mackey Date: Thu, 18 Jul 2024 19:27:53 -0400 Subject: [PATCH] Fix RTDs compatibility with custom domains (#328) * Fix RTDs compatilibity with custom domain * Update conf.py * Update conf.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- docs/conf.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index 110652fd..44df6da4 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,6 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +import os + from pkg_resources import DistributionNotFound, get_distribution try: @@ -8,6 +10,10 @@ except DistributionNotFound: __version__ = "unknown version" +# Support canonical URL +html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "") +if os.environ.get("READTHEDOCS", "") == "True": + html_context = {"READTHEDOCS": True} # General stuff extensions = [