Skip to content

Commit 9567171

Browse files
committed
Read the Docs no longer injects html_baseurl
1 parent 1f4c276 commit 9567171

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

sphinxext/opengraph/__init__.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def get_tags(
101101
tags['og:type'] = config.ogp_type
102102

103103
if not config.ogp_site_url and os.getenv('READTHEDOCS'):
104-
ogp_site_url = read_the_docs_site_url(config.html_baseurl)
104+
ogp_site_url = ambient_site_url()
105105
else:
106106
ogp_site_url = config.ogp_site_url
107107

@@ -236,13 +236,11 @@ def get_tags(
236236
)
237237

238238

239-
def read_the_docs_site_url(html_baseurl: str | None) -> str:
239+
def ambient_site_url() -> str:
240240
# readthedocs addons sets the READTHEDOCS_CANONICAL_URL variable,
241241
# or defines the ``html_baseurl`` variable in conf.py
242242
if rtd_canonical_url := os.getenv('READTHEDOCS_CANONICAL_URL'):
243243
parse_result = urlsplit(rtd_canonical_url)
244-
elif html_baseurl is not None:
245-
parse_result = urlsplit(html_baseurl)
246244
else:
247245
msg = 'ReadTheDocs did not provide a valid canonical URL!'
248246
raise RuntimeError(msg)

0 commit comments

Comments
 (0)