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)