diff --git a/sphinxext/opengraph/__init__.py b/sphinxext/opengraph/__init__.py index 65f29c5..70e4547 100644 --- a/sphinxext/opengraph/__init__.py +++ b/sphinxext/opengraph/__init__.py @@ -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(