Skip to content

Commit 4bf0d7a

Browse files
authored
Fix read the docs canonical url
1 parent 0cd67f5 commit 4bf0d7a

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

sphinxext/opengraph/__init__.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -253,16 +253,11 @@ def ambient_site_url() -> str:
253253
# readthedocs addons sets the READTHEDOCS_CANONICAL_URL variable,
254254
# or defines the ``html_baseurl`` variable in conf.py
255255
if rtd_canonical_url := os.getenv('READTHEDOCS_CANONICAL_URL'):
256-
parse_result = urlsplit(rtd_canonical_url)
256+
return rtd_canonical_url
257257
else:
258258
msg = 'ReadTheDocs did not provide a valid canonical URL!'
259259
raise RuntimeError(msg)
260260

261-
# Grab root url from canonical url
262-
return urlunsplit(
263-
(parse_result.scheme, parse_result.netloc, parse_result.path, '', '')
264-
)
265-
266261

267262
def social_card_for_page(
268263
config_social: dict[str, bool | str],

0 commit comments

Comments
 (0)