Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compatibility for RTD addons #129

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
8 changes: 7 additions & 1 deletion sphinxext/opengraph/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,13 @@ def get_tags(
parse_result = urlparse(config["html_baseurl"])

if config["html_baseurl"] is None:
raise OSError("ReadTheDocs did not provide a valid canonical URL!")
# rtd addons no longer configures html_baseurl
rtd_canonical_url = os.getenv("READTHEDOCS_CANONICAL_URL", "")

if not rtd_canonical_url:
raise OSError("ReadTheDocs did not provide a valid canonical URL!")
else:
parse_result = urlparse(rtd_canonical_url)

# Grab root url from canonical url
config["ogp_site_url"] = urlunparse(
Expand Down
Loading