Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
14 changes: 4 additions & 10 deletions sphinxext/opengraph/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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(
Expand Down
Loading