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

Canonical URLs are being outputted as foo.html instead of foo/ #1303

Closed
dmalan opened this issue Jul 11, 2022 · 2 comments
Closed

Canonical URLs are being outputted as foo.html instead of foo/ #1303

dmalan opened this issue Jul 11, 2022 · 2 comments
Labels
Bug A bug Needed: replication Bug replication is required

Comments

@dmalan
Copy link

dmalan commented Jul 11, 2022

Problem

For https://cs50.readthedocs.io/, the source for which is at https://github.com/cs50/cs50.readthedocs.io, we're using Sphinx HtmlDir at https://readthedocs.org/dashboard/cs50/advanced/, so that our URLs are of the form, e.g., https://cs50.readthedocs.io/code/ instead of https://cs50.readthedocs.io/code.html.

However, we noticed that sphinx_rtd_theme==1.0.0 is still outputting

<link rel="canonical" href="https://cs50.readthedocs.io/code.html" /> 

per

https://github.com/readthedocs/sphinx_rtd_theme/blob/master/sphinx_rtd_theme/layout.html#L52-L55

which we gather might be happening because conf.py.tmpl is setting canonical_url at https://github.com/readthedocs/readthedocs.org/blob/main/readthedocs/doc_builder/templates/doc_builder/conf.py.tmpl#L98. (Somehow, at least, theme_canonical_url is being set but not pageurl.) The result is that, e.g., Chrome on iOS, when you click the Share icon, copies that URL to the user's clipboard rather than the HtmlDir version thereof, so the recipient ends up with a 404.

The canonical link tag is not outputted when we build locally with make dirhtml, though.

Reproducible Project

https://cs50.readthedocs.io/code/

Error Logs/Results

Read the Docs build information
Build id: 17409789
Project: cs50
Version: latest
Commit: 8cc4272ae83166ccdfa7f2ed4ebd175421d49038
Date: 2022-07-11T15:10:52.977814Z
State: finished
Success: True


[rtd-command-info] start-time: 2022-07-11T15:12:25.463926Z, end-time: 2022-07-11T15:12:25.926319Z, duration: 0, exit-code: 0
git clone --no-single-branch --depth 50 https://github.com/cs50/cs50.readthedocs.io .
Cloning into '.'...

[rtd-command-info] start-time: 2022-07-11T15:12:26.127245Z, end-time: 2022-07-11T15:12:26.213132Z, duration: 0, exit-code: 0
git checkout --force origin/main
Note: switching to 'origin/main'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 8cc4272 removed canonical_url as having no effect

[rtd-command-info] start-time: 2022-07-11T15:12:26.511724Z, end-time: 2022-07-11T15:12:26.573298Z, duration: 0, exit-code: 0
git clean -d -f -f


[rtd-command-info] start-time: 2022-07-11T15:12:27.762895Z, end-time: 2022-07-11T15:12:32.484329Z, duration: 4, exit-code: 0
python3.7 -mvirtualenv /home/docs/checkouts/readthedocs.org/user_builds/cs50/envs/latest
Using base prefix '/home/docs/.pyenv/versions/3.7.9'
New python executable in /home/docs/checkouts/readthedocs.org/user_builds/cs50/envs/latest/bin/python3.7
Also creating executable in /home/docs/checkouts/readthedocs.org/user_builds/cs50/envs/latest/bin/python
Installing setuptools, pip, wheel...
done.

[rtd-command-info] start-time: 2022-07-11T15:12:32.679381Z, end-time: 2022-07-11T15:12:34.588451Z, duration: 1, exit-code: 0
/home/docs/checkouts/readthedocs.org/user_builds/cs50/envs/latest/bin/python -m pip install --upgrade --no-cache-dir pip setuptools<58.3.0
Requirement already satisfied: pip in /home/docs/checkouts/readthedocs.org/user_builds/cs50/envs/latest/lib/python3.7/site-packages (22.1.2)
Collecting setuptools<58.3.0
  Downloading setuptools-58.2.0-py3-none-any.whl (946 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 946.1/946.1 kB 17.9 MB/s eta 0:00:00
Installing collected packages: setuptools
  Attempting uninstall: setuptools
    Found existing installation: setuptools 63.1.0
    Uninstalling setuptools-63.1.0:
      Successfully uninstalled setuptools-63.1.0
Successfully installed setuptools-58.2.0

[rtd-command-info] start-time: 2022-07-11T15:12:34.817818Z, end-time: 2022-07-11T15:12:43.069614Z, duration: 8, exit-code: 0
/home/docs/checkouts/readthedocs.org/user_builds/cs50/envs/latest/bin/python -m pip install --upgrade --no-cache-dir mock==1.0.1 pillow==5.4.1 alabaster>=0.7,<0.8,!=0.7.5 commonmark==0.8.1 recommonmark==0.5.0 sphinx<2 sphinx-rtd-theme<0.5 readthedocs-sphinx-ext<2.2 jinja2<3.1.0
Collecting mock==1.0.1
  Downloading mock-1.0.1.zip (861 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 861.9/861.9 kB 16.9 MB/s eta 0:00:00
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting pillow==5.4.1
  Downloading Pillow-5.4.1-cp37-cp37m-manylinux1_x86_64.whl (2.0 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.0/2.0 MB 127.2 MB/s eta 0:00:00
Collecting alabaster!=0.7.5,<0.8,>=0.7
  Downloading alabaster-0.7.12-py2.py3-none-any.whl (14 kB)
Collecting commonmark==0.8.1
  Downloading commonmark-0.8.1-py2.py3-none-any.whl (47 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 47.4/47.4 kB 185.2 MB/s eta 0:00:00
Collecting recommonmark==0.5.0
  Downloading recommonmark-0.5.0-py2.py3-none-any.whl (9.8 kB)
Collecting sphinx<2
  Downloading Sphinx-1.8.6-py2.py3-none-any.whl (3.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.1/3.1 MB 130.2 MB/s eta 0:00:00
Collecting sphinx-rtd-theme<0.5
  Downloading sphinx_rtd_theme-0.4.3-py2.py3-none-any.whl (6.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.4/6.4 MB 133.3 MB/s eta 0:00:00
Collecting readthedocs-sphinx-ext<2.2
  Downloading readthedocs_sphinx_ext-2.1.8-py2.py3-none-any.whl (11 kB)
Collecting jinja2<3.1.0
  Downloading Jinja2-3.0.3-py3-none-any.whl (133 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 133.6/133.6 kB 218.9 MB/s eta 0:00:00
Collecting future
  Downloading future-0.18.2.tar.gz (829 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 829.2/829.2 kB 234.7 MB/s eta 0:00:00
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting docutils>=0.11
  Downloading docutils-0.19-py3-none-any.whl (570 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 570.5/570.5 kB 243.3 MB/s eta 0:00:00
Collecting packaging
  Downloading packaging-21.3-py3-none-any.whl (40 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 40.8/40.8 kB 176.8 MB/s eta 0:00:00
Collecting Pygments>=2.0
  Downloading Pygments-2.12.0-py3-none-any.whl (1.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 246.3 MB/s eta 0:00:00
Collecting sphinxcontrib-websupport
  Downloading sphinxcontrib_websupport-1.2.4-py2.py3-none-any.whl (39 kB)
Requirement already satisfied: setuptools in /home/docs/checkouts/readthedocs.org/user_builds/cs50/envs/latest/lib/python3.7/site-packages (from sphinx<2) (58.2.0)
Collecting docutils>=0.11
  Downloading docutils-0.17.1-py2.py3-none-any.whl (575 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 575.5/575.5 kB 240.3 MB/s eta 0:00:00
Collecting snowballstemmer>=1.1
  Downloading snowballstemmer-2.2.0-py2.py3-none-any.whl (93 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 93.0/93.0 kB 204.0 MB/s eta 0:00:00
Collecting requests>=2.0.0
  Downloading requests-2.28.1-py3-none-any.whl (62 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.8/62.8 kB 166.0 MB/s eta 0:00:00
Collecting six>=1.5
  Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting babel!=2.0,>=1.3
  Downloading Babel-2.10.3-py3-none-any.whl (9.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 9.5/9.5 MB 130.4 MB/s eta 0:00:00
Collecting imagesize
  Downloading imagesize-1.4.1-py2.py3-none-any.whl (8.8 kB)
Collecting MarkupSafe>=2.0
  Downloading MarkupSafe-2.1.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25 kB)
Collecting pytz>=2015.7
  Downloading pytz-2022.1-py2.py3-none-any.whl (503 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 503.5/503.5 kB 240.1 MB/s eta 0:00:00
Collecting urllib3<1.27,>=1.21.1
  Downloading urllib3-1.26.10-py2.py3-none-any.whl (139 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 139.2/139.2 kB 174.4 MB/s eta 0:00:00
Collecting idna<4,>=2.5
  Downloading idna-3.3-py3-none-any.whl (61 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.2/61.2 kB 203.0 MB/s eta 0:00:00
Collecting charset-normalizer<3,>=2
  Downloading charset_normalizer-2.1.0-py3-none-any.whl (39 kB)
Collecting certifi>=2017.4.17
  Downloading certifi-2022.6.15-py3-none-any.whl (160 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 160.2/160.2 kB 232.5 MB/s eta 0:00:00
Collecting pyparsing!=3.0.5,>=2.0.2
  Downloading pyparsing-3.0.9-py3-none-any.whl (98 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 98.3/98.3 kB 213.6 MB/s eta 0:00:00
Collecting sphinxcontrib-serializinghtml
  Downloading sphinxcontrib_serializinghtml-1.1.5-py2.py3-none-any.whl (94 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 94.0/94.0 kB 195.5 MB/s eta 0:00:00
Building wheels for collected packages: mock, future
  Building wheel for mock (setup.py): started
  Building wheel for mock (setup.py): finished with status 'done'
  Created wheel for mock: filename=mock-1.0.1-py3-none-any.whl size=23773 sha256=0b3ad66ab06477689715dba24db5aca65aeb310ca4239e6ba69e17a1f59e628f
  Stored in directory: /tmp/pip-ephem-wheel-cache-jwaxtedu/wheels/7a/94/b1/0fdc5339a5bd487a5cc15421ec200d9ba3e2aa7190e4a727f1
  Building wheel for future (setup.py): started
  Building wheel for future (setup.py): finished with status 'done'
  Created wheel for future: filename=future-0.18.2-py3-none-any.whl size=491070 sha256=f272af0553a9f494bc9a4f928aae898c1b78c6a4b9d23c1d6844249df2e11139
  Stored in directory: /tmp/pip-ephem-wheel-cache-jwaxtedu/wheels/56/b0/fe/4410d17b32f1f0c3cf54cdfb2bc04d7b4b8f4ae377e2229ba0
Successfully built mock future
Installing collected packages: snowballstemmer, pytz, mock, alabaster, urllib3, sphinxcontrib-serializinghtml, six, pyparsing, Pygments, pillow, MarkupSafe, imagesize, idna, future, docutils, charset-normalizer, certifi, babel, sphinxcontrib-websupport, requests, packaging, jinja2, commonmark, sphinx, readthedocs-sphinx-ext, sphinx-rtd-theme, recommonmark
Successfully installed MarkupSafe-2.1.1 Pygments-2.12.0 alabaster-0.7.12 babel-2.10.3 certifi-2022.6.15 charset-normalizer-2.1.0 commonmark-0.8.1 docutils-0.17.1 future-0.18.2 idna-3.3 imagesize-1.4.1 jinja2-3.0.3 mock-1.0.1 packaging-21.3 pillow-5.4.1 pyparsing-3.0.9 pytz-2022.1 readthedocs-sphinx-ext-2.1.8 recommonmark-0.5.0 requests-2.28.1 six-1.16.0 snowballstemmer-2.2.0 sphinx-1.8.6 sphinx-rtd-theme-0.4.3 sphinxcontrib-serializinghtml-1.1.5 sphinxcontrib-websupport-1.2.4 urllib3-1.26.10

[rtd-command-info] start-time: 2022-07-11T15:12:43.277933Z, end-time: 2022-07-11T15:12:47.464425Z, duration: 4, exit-code: 0
/home/docs/checkouts/readthedocs.org/user_builds/cs50/envs/latest/bin/python -m pip install --exists-action=w --no-cache-dir -r requirements.txt
Collecting myst-parser==0.17.2
  Downloading myst_parser-0.17.2-py3-none-any.whl (53 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 53.8/53.8 kB 3.9 MB/s eta 0:00:00
Collecting sphinx==4.5.0
  Downloading Sphinx-4.5.0-py3-none-any.whl (3.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.1/3.1 MB 49.7 MB/s eta 0:00:00
Collecting sphinx-markdown-tables==0.0.15
  Downloading sphinx_markdown_tables-0.0.15-py3-none-any.whl (28 kB)
Collecting sphinx-tabs==3.3.1
  Downloading sphinx_tabs-3.3.1-py3-none-any.whl (10.0 kB)
Collecting sphinx_rtd_theme==1.0.0
  Downloading sphinx_rtd_theme-1.0.0-py2.py3-none-any.whl (2.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.8/2.8 MB 137.8 MB/s eta 0:00:00
Collecting sphinxcontrib-httpdomain==1.8.0
  Downloading sphinxcontrib_httpdomain-1.8.0-py2.py3-none-any.whl (19 kB)
Collecting sphinxext-opengraph==0.6.3
  Downloading sphinxext_opengraph-0.6.3-py3-none-any.whl (8.3 kB)
Collecting mdit-py-plugins~=0.3.0
  Downloading mdit_py_plugins-0.3.0-py3-none-any.whl (43 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 43.7/43.7 kB 131.2 MB/s eta 0:00:00
Collecting pyyaml
  Downloading PyYAML-6.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (596 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 596.3/596.3 kB 242.7 MB/s eta 0:00:00
Collecting markdown-it-py<3.0.0,>=1.0.0
  Downloading markdown_it_py-2.1.0-py3-none-any.whl (84 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 84.5/84.5 kB 206.1 MB/s eta 0:00:00
Requirement already satisfied: docutils<0.18,>=0.15 in /home/docs/checkouts/readthedocs.org/user_builds/cs50/envs/latest/lib/python3.7/site-packages (from myst-parser==0.17.2->-r requirements.txt (line 1)) (0.17.1)
Collecting typing-extensions
  Downloading typing_extensions-4.3.0-py3-none-any.whl (25 kB)
Requirement already satisfied: jinja2 in /home/docs/checkouts/readthedocs.org/user_builds/cs50/envs/latest/lib/python3.7/site-packages (from myst-parser==0.17.2->-r requirements.txt (line 1)) (3.0.3)
Requirement already satisfied: sphinxcontrib-serializinghtml>=1.1.5 in /home/docs/checkouts/readthedocs.org/user_builds/cs50/envs/latest/lib/python3.7/site-packages (from sphinx==4.5.0->-r requirements.txt (line 2)) (1.1.5)
Collecting sphinxcontrib-jsmath
  Downloading sphinxcontrib_jsmath-1.0.1-py2.py3-none-any.whl (5.1 kB)
Requirement already satisfied: snowballstemmer>=1.1 in /home/docs/checkouts/readthedocs.org/user_builds/cs50/envs/latest/lib/python3.7/site-packages (from sphinx==4.5.0->-r requirements.txt (line 2)) (2.2.0)
Requirement already satisfied: babel>=1.3 in /home/docs/checkouts/readthedocs.org/user_builds/cs50/envs/latest/lib/python3.7/site-packages (from sphinx==4.5.0->-r requirements.txt (line 2)) (2.10.3)
Collecting sphinxcontrib-applehelp
  Downloading sphinxcontrib_applehelp-1.0.2-py2.py3-none-any.whl (121 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.2/121.2 kB 221.9 MB/s eta 0:00:00
Collecting sphinxcontrib-qthelp
  Downloading sphinxcontrib_qthelp-1.0.3-py2.py3-none-any.whl (90 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 90.6/90.6 kB 208.4 MB/s eta 0:00:00
Collecting sphinxcontrib-devhelp
  Downloading sphinxcontrib_devhelp-1.0.2-py2.py3-none-any.whl (84 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 84.7/84.7 kB 210.0 MB/s eta 0:00:00
Requirement already satisfied: requests>=2.5.0 in /home/docs/checkouts/readthedocs.org/user_builds/cs50/envs/latest/lib/python3.7/site-packages (from sphinx==4.5.0->-r requirements.txt (line 2)) (2.28.1)
Collecting sphinxcontrib-htmlhelp>=2.0.0
  Downloading sphinxcontrib_htmlhelp-2.0.0-py2.py3-none-any.whl (100 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.5/100.5 kB 219.1 MB/s eta 0:00:00
Requirement already satisfied: Pygments>=2.0 in /home/docs/checkouts/readthedocs.org/user_builds/cs50/envs/latest/lib/python3.7/site-packages (from sphinx==4.5.0->-r requirements.txt (line 2)) (2.12.0)
Collecting importlib-metadata>=4.4
  Downloading importlib_metadata-4.12.0-py3-none-any.whl (21 kB)
Requirement already satisfied: alabaster<0.8,>=0.7 in /home/docs/checkouts/readthedocs.org/user_builds/cs50/envs/latest/lib/python3.7/site-packages (from sphinx==4.5.0->-r requirements.txt (line 2)) (0.7.12)
Requirement already satisfied: packaging in /home/docs/checkouts/readthedocs.org/user_builds/cs50/envs/latest/lib/python3.7/site-packages (from sphinx==4.5.0->-r requirements.txt (line 2)) (21.3)
Requirement already satisfied: imagesize in /home/docs/checkouts/readthedocs.org/user_builds/cs50/envs/latest/lib/python3.7/site-packages (from sphinx==4.5.0->-r requirements.txt (line 2)) (1.4.1)
Collecting markdown>=3.0.1
  Downloading Markdown-3.3.7-py3-none-any.whl (97 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 97.8/97.8 kB 216.5 MB/s eta 0:00:00
Requirement already satisfied: six in /home/docs/checkouts/readthedocs.org/user_builds/cs50/envs/latest/lib/python3.7/site-packages (from sphinxcontrib-httpdomain==1.8.0->-r requirements.txt (line 6)) (1.16.0)
Requirement already satisfied: pytz>=2015.7 in /home/docs/checkouts/readthedocs.org/user_builds/cs50/envs/latest/lib/python3.7/site-packages (from babel>=1.3->sphinx==4.5.0->-r requirements.txt (line 2)) (2022.1)
Collecting zipp>=0.5
  Downloading zipp-3.8.0-py3-none-any.whl (5.4 kB)
Requirement already satisfied: MarkupSafe>=2.0 in /home/docs/checkouts/readthedocs.org/user_builds/cs50/envs/latest/lib/python3.7/site-packages (from jinja2->myst-parser==0.17.2->-r requirements.txt (line 1)) (2.1.1)
Collecting mdurl~=0.1
  Downloading mdurl-0.1.1-py3-none-any.whl (10 kB)
Requirement already satisfied: certifi>=2017.4.17 in /home/docs/checkouts/readthedocs.org/user_builds/cs50/envs/latest/lib/python3.7/site-packages (from requests>=2.5.0->sphinx==4.5.0->-r requirements.txt (line 2)) (2022.6.15)
Requirement already satisfied: charset-normalizer<3,>=2 in /home/docs/checkouts/readthedocs.org/user_builds/cs50/envs/latest/lib/python3.7/site-packages (from requests>=2.5.0->sphinx==4.5.0->-r requirements.txt (line 2)) (2.1.0)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /home/docs/checkouts/readthedocs.org/user_builds/cs50/envs/latest/lib/python3.7/site-packages (from requests>=2.5.0->sphinx==4.5.0->-r requirements.txt (line 2)) (1.26.10)
Requirement already satisfied: idna<4,>=2.5 in /home/docs/checkouts/readthedocs.org/user_builds/cs50/envs/latest/lib/python3.7/site-packages (from requests>=2.5.0->sphinx==4.5.0->-r requirements.txt (line 2)) (3.3)
Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in /home/docs/checkouts/readthedocs.org/user_builds/cs50/envs/latest/lib/python3.7/site-packages (from packaging->sphinx==4.5.0->-r requirements.txt (line 2)) (3.0.9)
Installing collected packages: zipp, typing-extensions, sphinxcontrib-qthelp, sphinxcontrib-jsmath, sphinxcontrib-htmlhelp, sphinxcontrib-devhelp, sphinxcontrib-applehelp, pyyaml, mdurl, markdown-it-py, importlib-metadata, sphinx, mdit-py-plugins, markdown, sphinxext-opengraph, sphinxcontrib-httpdomain, sphinx-tabs, sphinx_rtd_theme, sphinx-markdown-tables, myst-parser
  Attempting uninstall: sphinx
    Found existing installation: Sphinx 1.8.6
    Uninstalling Sphinx-1.8.6:
      Successfully uninstalled Sphinx-1.8.6
  Attempting uninstall: sphinx_rtd_theme
    Found existing installation: sphinx-rtd-theme 0.4.3
    Uninstalling sphinx-rtd-theme-0.4.3:
      Successfully uninstalled sphinx-rtd-theme-0.4.3
Successfully installed importlib-metadata-4.12.0 markdown-3.3.7 markdown-it-py-2.1.0 mdit-py-plugins-0.3.0 mdurl-0.1.1 myst-parser-0.17.2 pyyaml-6.0 sphinx-4.5.0 sphinx-markdown-tables-0.0.15 sphinx-tabs-3.3.1 sphinx_rtd_theme-1.0.0 sphinxcontrib-applehelp-1.0.2 sphinxcontrib-devhelp-1.0.2 sphinxcontrib-htmlhelp-2.0.0 sphinxcontrib-httpdomain-1.8.0 sphinxcontrib-jsmath-1.0.1 sphinxcontrib-qthelp-1.0.3 sphinxext-opengraph-0.6.3 typing-extensions-4.3.0 zipp-3.8.0

[rtd-command-info] start-time: 2022-07-11T15:12:49.556961Z, end-time: 2022-07-11T15:12:49.633047Z, duration: 0, exit-code: 0
cat conf.py
import time

exclude_patterns = ["README.md"]

extensions = [
    "myst_parser",
    "sphinx_markdown_tables",
    "sphinx_tabs.tabs",
    "sphinxcontrib.httpdomain",
    "sphinxext.opengraph"
]

html_css_files = [
    "/_static/custom.css?" + str(round(time.time())),
    "https://use.fontawesome.com/releases/v5.13.0/css/all.css"
]
html_js_files = ["/_static/custom.js?" + str(round(time.time()))]
html_static_path = ["_static"]
html_theme = "sphinx_rtd_theme"
html_theme_options = {
    "display_version": False,
    "prev_next_buttons_location": False,
    "sticky_navigation": False
}
html_title = "CS50 Docs"

myst_heading_anchors = 6

ogp_image = "https://cs50.readthedocs.io/_images/2ep2od.jpg"
ogp_image_alt = "ALL THE DOCS"
ogp_site_url = "https://cs50.readthedocs.io/"

project = "CS50 Docs"




###########################################################################
#          auto-created readthedocs.org specific configuration            #
###########################################################################


#
# The following code was added during an automated build on readthedocs.org
# It is auto created and injected for every build. The result is based on the
# conf.py.tmpl file found in the readthedocs.org codebase:
# https://github.com/rtfd/readthedocs.org/blob/main/readthedocs/doc_builder/templates/doc_builder/conf.py.tmpl
#
# Note: this file shouldn't rely on extra dependencies.

import importlib
import sys
import os.path

# Borrowed from six.
PY3 = sys.version_info[0] == 3
string_types = str if PY3 else basestring

from sphinx import version_info

# Get suffix for proper linking to GitHub
# This is deprecated in Sphinx 1.3+,
# as each page can have its own suffix
if globals().get('source_suffix', False):
    if isinstance(source_suffix, string_types):
        SUFFIX = source_suffix
    elif isinstance(source_suffix, (list, tuple)):
        # Sphinx >= 1.3 supports list/tuple to define multiple suffixes
        SUFFIX = source_suffix[0]
    elif isinstance(source_suffix, dict):
        # Sphinx >= 1.8 supports a mapping dictionary for multiple suffixes
        SUFFIX = list(source_suffix.keys())[0]  # make a ``list()`` for py2/py3 compatibility
    else:
        # default to .rst
        SUFFIX = '.rst'
else:
    SUFFIX = '.rst'

# Add RTD Static Path. Add to the end because it overwrites previous files.
if not 'html_static_path' in globals():
    html_static_path = []
if os.path.exists('_static'):
    html_static_path.append('_static')

# Add RTD Theme only if they aren't overriding it already
using_rtd_theme = (
    (
        'html_theme' in globals() and
        html_theme in ['default'] and
        # Allow people to bail with a hack of having an html_style
        'html_style' not in globals()
    ) or 'html_theme' not in globals()
)
if using_rtd_theme:
    theme = importlib.import_module('sphinx_rtd_theme')
    html_theme = 'sphinx_rtd_theme'
    html_style = None
    html_theme_options = {}
    if 'html_theme_path' in globals():
        html_theme_path.append(theme.get_html_theme_path())
    else:
        html_theme_path = [theme.get_html_theme_path()]

if globals().get('websupport2_base_url', False):
    websupport2_base_url = 'https://readthedocs.org/websupport'
    websupport2_static_url = 'https://assets.readthedocs.org/static/'


#Add project information to the template context.
context = {
    'using_theme': using_rtd_theme,
    'html_theme': html_theme,
    'current_version': "latest",
    'version_slug': "latest",
    'MEDIA_URL': "https://media.readthedocs.org/",
    'STATIC_URL': "https://assets.readthedocs.org/static/",
    'PRODUCTION_DOMAIN': "readthedocs.org",
    'proxied_static_path': "/_/static/",
    'versions': [
    ("latest", "/en/latest/"),
    ],
    'downloads': [ 
    ],
    'subprojects': [ 
        ("lib50", "https://cs50.readthedocs.io/projects/lib50/en/latest/"),
        ("check50", "https://cs50.readthedocs.io/projects/check50/en/latest/"),
        ("compare50", "https://cs50.readthedocs.io/projects/compare50/en/latest/"),
    ],
    'slug': 'cs50',
    'name': u'cs50',
    'rtd_language': u'en',
    'programming_language': u'words',
    'canonical_url': 'https://cs50.readthedocs.io/',
    'analytics_code': 'None',
    'single_version': False,
    'conf_py_path': '/',
    'api_host': 'https://readthedocs.org',
    'github_user': 'cs50',
    'proxied_api_host': '/_',
    'github_repo': 'cs50.readthedocs.io',
    'github_version': 'main',
    'display_github': True,
    'bitbucket_user': 'None',
    'bitbucket_repo': 'None',
    'bitbucket_version': 'main',
    'display_bitbucket': False,
    'gitlab_user': 'None',
    'gitlab_repo': 'None',
    'gitlab_version': 'main',
    'display_gitlab': False,
    'READTHEDOCS': True,
    'using_theme': (html_theme == "default"),
    'new_theme': (html_theme == "sphinx_rtd_theme"),
    'source_suffix': SUFFIX,
    'ad_free': True,
    'docsearch_disabled': False,
    'user_analytics_code': '',
    'global_analytics_code': 'UA-17997319-1',
    'commit': '8cc4272a',
}

# For sphinx >=1.8 we can use html_baseurl to set the canonical URL.
# https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_baseurl
if version_info >= (1, 8):
    if not globals().get('html_baseurl'):
        html_baseurl = context['canonical_url']
    context['canonical_url'] = None





if 'html_context' in globals():
    
    html_context.update(context)
    
else:
    html_context = context

# Add custom RTD extension
if 'extensions' in globals():
    # Insert at the beginning because it can interfere
    # with other extensions.
    # See https://github.com/rtfd/readthedocs.org/pull/4054
    extensions.insert(0, "readthedocs_ext.readthedocs")
else:
    extensions = ["readthedocs_ext.readthedocs"]

# Add External version warning banner to the external version documentation
if 'branch' == 'external':
    extensions.insert(1, "readthedocs_ext.external_version_warning")
    readthedocs_vcs_url = 'None'
    readthedocs_build_url = 'https://readthedocs.org/projects/cs50/builds/17409789/'

project_language = 'en'

# User's Sphinx configurations
language_user = globals().get('language', None)
latex_engine_user = globals().get('latex_engine', None)
latex_elements_user = globals().get('latex_elements', None)

# Remove this once xindy gets installed in Docker image and XINDYOPS
# env variable is supported
# https://github.com/rtfd/readthedocs-docker-images/pull/98
latex_use_xindy = False

chinese = any([
    language_user in ('zh_CN', 'zh_TW'),
    project_language in ('zh_CN', 'zh_TW'),
])

japanese = any([
    language_user == 'ja',
    project_language == 'ja',
])

if chinese:
    latex_engine = latex_engine_user or 'xelatex'

    latex_elements_rtd = {
        'preamble': '\\usepackage[UTF8]{ctex}\n',
    }
    latex_elements = latex_elements_user or latex_elements_rtd
elif japanese:
    latex_engine = latex_engine_user or 'platex'

# Make sure our build directory is always excluded
exclude_patterns = globals().get('exclude_patterns', [])
exclude_patterns.extend(['_build'])

[rtd-command-info] start-time: 2022-07-11T15:12:49.897190Z, end-time: 2022-07-11T15:12:54.554538Z, duration: 4, exit-code: 0
/home/docs/checkouts/readthedocs.org/user_builds/cs50/envs/latest/bin/python -m sphinx -T -E -b dirhtml -d _build/doctrees -D language=en . _build/html
Running Sphinx v4.5.0
loading translations [en]... done
making output directory... done
myst v0.17.2: MdParserConfig(commonmark_only=False, gfm_only=False, enable_extensions=[], linkify_fuzzy_links=True, dmath_allow_labels=True, dmath_allow_space=True, dmath_allow_digits=True, dmath_double_inline=False, update_mathjax=True, mathjax_classes='tex2jax_process|mathjax_process|math|output_area', disable_syntax=[], all_links_external=False, url_schemes=('http', 'https', 'mailto', 'ftp'), ref_domains=None, highlight_code_blocks=True, number_code_blocks=[], title_to_header=False, heading_anchors=6, heading_slug_func=None, footnote_transition=True, sub_delimiters=('{', '}'), words_per_minute=200)
building [mo]: targets for 0 po files that are out of date
building [dirhtml]: targets for 42 source files that are out of date
updating environment: [new config] 42 added, 0 changed, 0 removed
reading sources... [  2%] api/dining
reading sources... [  4%] api/index
reading sources... [  7%] api/map
reading sources... [  9%] cli50
reading sources... [ 11%] code
reading sources... [ 14%] cs50/check
reading sources... [ 16%] cs50/cli
reading sources... [ 19%] cs50/codespace
reading sources... [ 21%] cs50/ide
reading sources... [ 23%] cs50/sandbox
reading sources... [ 26%] cs50/server
reading sources... [ 28%] docker
reading sources... [ 30%] forms
reading sources... [ 33%] github
reading sources... [ 35%] heroku
reading sources... [ 38%] id
reading sources... [ 40%] ide/faqs
reading sources... [ 42%] ide/index
reading sources... [ 45%] ide/offline
reading sources... [ 47%] ide/online
reading sources... [ 50%] index
reading sources... [ 52%] lab
reading sources... [ 54%] libraries/cs50/c
reading sources... [ 57%] libraries/cs50/index
reading sources... [ 59%] libraries/cs50/python
reading sources... [ 61%] libraries/index
reading sources... [ 64%] pip
reading sources... [ 66%] python
reading sources... [ 69%] render
reading sources... [ 71%] render50
reading sources... [ 73%] sandbox
reading sources... [ 76%] site
reading sources... [ 78%] sites
reading sources... [ 80%] style/c
reading sources... [ 83%] style50
reading sources... [ 85%] submit50
reading sources... [ 88%] terminal
reading sources... [ 90%] themes/jekyll
reading sources... [ 92%] time
reading sources... [ 95%] vault
reading sources... [ 97%] video
reading sources... [100%] zoom

looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [  2%] api/dining
writing output... [  4%] api/index
writing output... [  7%] api/map
writing output... [  9%] cli50
writing output... [ 11%] code
writing output... [ 14%] cs50/check
writing output... [ 16%] cs50/cli
writing output... [ 19%] cs50/codespace
writing output... [ 21%] cs50/ide
writing output... [ 23%] cs50/sandbox
writing output... [ 26%] cs50/server
writing output... [ 28%] docker
writing output... [ 30%] forms
writing output... [ 33%] github
writing output... [ 35%] heroku
writing output... [ 38%] id
writing output... [ 40%] ide/faqs
writing output... [ 42%] ide/index
writing output... [ 45%] ide/offline
writing output... [ 47%] ide/online
writing output... [ 50%] index
writing output... [ 52%] lab
writing output... [ 54%] libraries/cs50/c
writing output... [ 57%] libraries/cs50/index
writing output... [ 59%] libraries/cs50/python
writing output... [ 61%] libraries/index
writing output... [ 64%] pip
writing output... [ 66%] python
writing output... [ 69%] render
writing output... [ 71%] render50
writing output... [ 73%] sandbox
writing output... [ 76%] site
writing output... [ 78%] sites
writing output... [ 80%] style/c
writing output... [ 83%] style50
writing output... [ 85%] submit50
writing output... [ 88%] terminal
writing output... [ 90%] themes/jekyll
writing output... [ 92%] time
writing output... [ 95%] vault
writing output... [ 97%] video
writing output... [100%] zoom

generating indices... genindex http-routingtable done
writing additional pages... search done
copying images... [  6%] ide/plus.png
copying images... [ 12%] ide/console.png
copying images... [ 18%] ide/unsaved.png
copying images... [ 25%] ide/history.png
copying images... [ 31%] ide/layout.png
copying images... [ 37%] ide/dark-mode.png
copying images... [ 43%] ide/share.png
copying images... [ 50%] ide/add-member-0.png
copying images... [ 56%] ide/add-member-1.png
copying images... [ 62%] ide/remove-member-0.png
copying images... [ 68%] ide/remove-member-1.png
copying images... [ 75%] 2ep2od.jpg
copying images... [ 81%] teacher_sites/_includes.png
copying images... [ 87%] teacher_sites/github1.png
copying images... [ 93%] teacher_sites/github2.png
copying images... [100%] teacher_sites/github3.png

copying static files... done
copying extra files... done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded.

The HTML pages are in _build/html.
Updating searchtools for Read the Docs search...

Expected Results

Build should be outputting HtmlDir-style canonical URLs like:

<link rel="canonical" href="https://cs50.readthedocs.io/code/" /> 

Environment Info

  • Python Version: CPython 3.x, per https://readthedocs.org/dashboard/cs50/advanced/
  • Sphinx Version:
    sphinx==4.5.0
    sphinx-markdown-tables==0.0.15
    sphinx-tabs==3.3.1
    sphinxcontrib-httpdomain==1.8.0
    sphinxext-opengraph==0.6.3
    
  • RTD Theme Version: sphinx_rtd_theme==1.0.0
@dmalan dmalan added Bug A bug Needed: replication Bug replication is required labels Jul 11, 2022
@humitos
Copy link
Member

humitos commented Jul 26, 2022

The canonical link tag is not outputted when we build locally with make dirhtml, though.

I'd like to reproduce the behavior reported on this issue locally. That will help us to debug the problem in an easier way. However, I wasn't able to do this.

I added the following to the conf.py trying to reproduce this problem and I couldn't:

# conf.py

html_context = {
    'canonical_url': 'https://cs50.readthedocs.io/',
}

# ... and ...

html_theme_options.update({
    'canonical_url': 'https://cs50.readthedocs.io/',
})

What would be the correct combination of html_context/html_theme_options we need to define here?

Note I got the value for canonical_url from the Read the Docs production database, to use the same value than there.

@humitos
Copy link
Member

humitos commented Aug 12, 2024

canonical_url is deprecated and shouldn't be used anymore, you should html_baseurl now instead.

You can add the following snippet in your conf.py if you are building on Read the Docs:

import os

# Define the canonical URL if you are using a custom domain on Read the Docs
html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "")

Let me know if that solves the issue. Feel free to re-open the issue if it doesn't.

@humitos humitos closed this as not planned Won't fix, can't repro, duplicate, stale Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug Needed: replication Bug replication is required
Projects
None yet
Development

No branches or pull requests

2 participants