From 926e188a14c6f38d9259d44e891abeccc0823fef Mon Sep 17 00:00:00 2001 From: Maciej Olko Date: Wed, 28 May 2025 00:52:05 +0200 Subject: [PATCH] Read the Docs no longer injects html_baseurl: update test and comment Follow-up for 9567171ab5758dbaba35ba5163feb2096b437f2b --- sphinxext/opengraph/__init__.py | 3 +-- tests/test_options.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/sphinxext/opengraph/__init__.py b/sphinxext/opengraph/__init__.py index ba021a0..bc6f3c6 100644 --- a/sphinxext/opengraph/__init__.py +++ b/sphinxext/opengraph/__init__.py @@ -250,8 +250,7 @@ def get_tags( def ambient_site_url() -> str: - # readthedocs addons sets the READTHEDOCS_CANONICAL_URL variable, - # or defines the ``html_baseurl`` variable in conf.py + # readthedocs addons sets the READTHEDOCS_CANONICAL_URL variable if rtd_canonical_url := os.getenv('READTHEDOCS_CANONICAL_URL'): parse_result = urlsplit(rtd_canonical_url) else: diff --git a/tests/test_options.py b/tests/test_options.py index 6ff849b..5b29686 100644 --- a/tests/test_options.py +++ b/tests/test_options.py @@ -305,7 +305,7 @@ def test_rtd_override(app: Sphinx, monkeypatch): @pytest.mark.sphinx('html', testroot='rtd-default') def test_rtd_valid(app: Sphinx, monkeypatch): monkeypatch.setenv('READTHEDOCS', 'True') - app.config.html_baseurl = 'https://failure.com/en/latest/' + monkeypatch.setenv('READTHEDOCS_CANONICAL_URL', 'https://failure.com/en/latest/') app.build() tags = conftest._og_meta_tags(app)