Use correct canonical URL while building docs (#6829)

As noted in https://github.com/readthedocs/readthedocs.org/pull/10224 with the current configuration the canonical URL is wrong with different sphinx builds. For instance the "latest" docs point to "stable". This leads to apps like Mastodon to generate previews to pages which don't exist since they rely on

    <link rel="canonical" href="https://jupyter-notebook.readthedocs.io/en/stable/notebook_7_features.html" />

This should fix that.
This commit is contained in:
Ashwin V. Mohanan 2023-04-05 13:54:03 +02:00 committed by GitHub
parent 2f9aa01a8f
commit 6e60c72ead
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -265,6 +265,11 @@ html_static_path = ["_static"]
# Output file base name for HTML help builder.
htmlhelp_basename = "JupyterNotebookdoc"
# This will ensure that we use the correctly set environment for canonical URLs
# Old Read the Docs injections makes it point only to the default version,
# for instance /en/stable/
html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "/")
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {}