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

Build: export READTHEDOCS_CANONICAL_URL variable #10166

Merged
merged 8 commits into from
Mar 22, 2023
Merged

Conversation

humitos
Copy link
Member

@humitos humitos commented Mar 21, 2023

This variable communicates what's the canonical URL for the version it's running
the build. It will allow doctool/theme authors to implement the correct HTML tag
required:

<link rel="canonical" href="" />

Note the final href on each page will be READTHEDOCS_CANONICAL_URL + page.

Closes readthedocs/readthedocs-ops#1320
Closes #9781
Closes #8260
Closes #4820


📚 Documentation previews 📚

humitos added 2 commits March 21, 2023 10:56
This variable communicates what's the canonical URL for the version it's running
the build. It will allow doctool/theme authors to implement the correct HTML tag
required:

```
<link rel="canonical" href="" />
```

Note the final `href` on each page will be `READTHEDOCS_CANONICAL_URL` + `page`.

Closes readthedocs/readthedocs-ops#1320
Add it to the reference page.
@humitos humitos requested review from a team as code owners March 21, 2023 10:05
@humitos humitos requested a review from benjaoming March 21, 2023 10:05
@humitos
Copy link
Member Author

humitos commented Mar 21, 2023

Yay! Docdiff for the win!

Screenshot_2023-03-21_11-09-08

@benjaoming
Copy link
Contributor

This is a great idea. The current situation is that links for PR builds break link previews.

Should we start using it for the Sphinx builder config so people who might see the injected configuration will understand the new pattern? https://github.com/readthedocs/readthedocs.org/blob/main/readthedocs/doc_builder/templates/doc_builder/conf.py.tmpl#L155

Copy link
Contributor

@benjaoming benjaoming left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work 🎉

If you are updating the tests, I think you should use strict values rather than <ANY> so we can detect changes to the canonical URL in a very strict sense.

readthedocs/doc_builder/director.py Show resolved Hide resolved
docs/user/reference/environment-variables.rst Show resolved Hide resolved
docs/user/reference/environment-variables.rst Outdated Show resolved Hide resolved
docs/user/reference/environment-variables.rst Outdated Show resolved Hide resolved
@humitos
Copy link
Member Author

humitos commented Mar 21, 2023

@benjaoming

Should we start using it for the Sphinx builder config so people who might see the injected configuration will understand the new pattern? main/readthedocs/doc_builder/templates/doc_builder/conf.py.tmpl#L155

From our conversation on Slack, I understood that we are going to slowly deprecate this feature and rely on doctool/theme authors to implement it correctly by using this new environment variable. In general, we are moving away from the idea of "do magical things on behalf of our users"

@humitos humitos requested a review from benjaoming March 21, 2023 11:06
Copy link
Contributor

@benjaoming benjaoming left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 Thanks for addressing the feedback 🥇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
2 participants