Skip to content

Commit

Permalink
Use correct canonical URL while building docs (#6829)
Browse files Browse the repository at this point in the history
As noted in readthedocs/readthedocs.org#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.
  • Loading branch information
ashwinvis authored Apr 5, 2023
1 parent 2f9aa01 commit 6e60c72
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,11 @@
# 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 = {}
Expand Down

0 comments on commit 6e60c72

Please sign in to comment.