Skip to content

Commit 0155808

Browse files
authored
Add compatibility for RTD addons
1 parent 9db9a2c commit 0155808

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

sphinxext/opengraph/__init__.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,13 @@ def get_tags(
8989
parse_result = urlparse(config["html_baseurl"])
9090

9191
if config["html_baseurl"] is None:
92-
raise OSError("ReadTheDocs did not provide a valid canonical URL!")
92+
# rtd addons no longer configures html_baseurl
93+
rtd_canonical_url = os.getenv("READTHEDOCS_CANONICAL_URL", "")
94+
95+
if not rtd_canonical_url:
96+
raise OSError("ReadTheDocs did not provide a valid canonical URL!")
97+
else:
98+
parse_result = urlparse(rtd_canonical_url)
9399

94100
# Grab root url from canonical url
95101
config["ogp_site_url"] = urlunparse(

0 commit comments

Comments
 (0)