diff --git a/docs/conf.py b/docs/conf.py index f1fc182..54d5a9e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -62,8 +62,6 @@ # -- Configuration for this theme -------------------------------------------- -ogp_site_url = 'https://sphinxext-opengraph.readthedocs.io/en/latest/' - # Configuration for testing but generally we use the defaults # Uncomment lines to see their effect. ogp_social_cards = { diff --git a/sphinxext/opengraph/__init__.py b/sphinxext/opengraph/__init__.py index ba021a0..574d13a 100644 --- a/sphinxext/opengraph/__init__.py +++ b/sphinxext/opengraph/__init__.py @@ -4,7 +4,7 @@ import posixpath from pathlib import Path from typing import TYPE_CHECKING -from urllib.parse import urljoin, urlparse, urlsplit, urlunsplit +from urllib.parse import urljoin, urlparse from docutils import nodes @@ -253,15 +253,9 @@ def ambient_site_url() -> str: # readthedocs addons sets the READTHEDOCS_CANONICAL_URL variable, # or defines the ``html_baseurl`` variable in conf.py if rtd_canonical_url := os.getenv('READTHEDOCS_CANONICAL_URL'): - parse_result = urlsplit(rtd_canonical_url) - else: - msg = 'ReadTheDocs did not provide a valid canonical URL!' - raise RuntimeError(msg) - - # Grab root url from canonical url - return urlunsplit( - (parse_result.scheme, parse_result.netloc, parse_result.path, '', '') - ) + return rtd_canonical_url + msg = 'ReadTheDocs did not provide a valid canonical URL!' + raise RuntimeError(msg) def social_card_for_page(