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

Doc: Render version/language selector on Read the Docs #116966

Merged
merged 5 commits into from
Apr 17, 2024

Conversation

humitos
Copy link
Contributor

@humitos humitos commented Mar 18, 2024

Integrate the new Read the Docs Addons into the Python Docs Sphinx theme to render versions and languages selector nicely, using the JavaScript readthedocs-addons-data-ready custom event triggered by the Read the Docs Addons.

References:

I'm opening this PR here as a POC to continue the conversation on the Discord thread linked.

Example

This example was built locally on a development Read the Docs instance. The languages and versions shown in the example are:

  • translations configured on the development Read the Docs instance
  • active, built and not hidden versions on the development Read the Docs instance

It shows readthedocs-selector because it's the branch where I was making these changes. It shows latest, because I forgot to disable it 😄

Peek 2024-03-18 17-54

Note this PR is not linked to any issue yet since it comes from a Discord conversation


📚 Documentation preview 📚: https://cpython-previews--116966.org.readthedocs.build/

Integrate the new Read the Docs Addons JavaScript into the Python Docs Sphinx
theme to render versions and languages selector nicely.

References:

* Discord thread: https://discord.com/channels/935215565872693329/1159601953265942589
* Implementation of Addons JavaScript `CustomEvent`: readthedocs/addons#64
* Conversation about using Read the Docs: python/docs-community#5
@humitos
Copy link
Contributor Author

humitos commented Apr 9, 2024

I the Discord conversation some weeks ago, we agreed on these following steps:

  • test the selectors for mobile browsers
  • add some hardcoded links pointing to the official docs as example
  • merge the upstream PR for CustomEvent
  • maybe ask for someone else's feedback
  • merge the PR on CPython and test on Read the Docs
  • adapt / fix anything we find required

I was able to work more on the Read the Docs side and I'm waiting for some PRs to be reviewed, merged and deployed there. In the meanwhile, I updated this PR with some changes required to match the API JSON structure (we are freezing on v1 now and we don't expect breaking changes soon)

@humitos
Copy link
Contributor Author

humitos commented Apr 16, 2024

The required upstream PRs were already merged and we are going to release/deploy them today in a few hours. I pushed the latest required changes to this PR and tested it locally. Everything works as expected, so we are ready to move to the next step.

@hugovk I'd appreciate a small review/approve here and decide whether or not to ask someone else for feedback at this stage. We can also move forward and merge this PR first and after that ask for feedback on the deployed version of the docs under Read the Docs at cpython-previews project.

@humitos
Copy link
Contributor Author

humitos commented Apr 16, 2024

The required upstream PRs were already merged and we are going to release/deploy them today in a few hours

This is deployed and can be previewed at https://cpython-previews--116966.org.readthedocs.build/en/116966/

@hugovk
Copy link
Member

hugovk commented Apr 17, 2024

Thanks, this is looking good, let's merge and iterate!

@hugovk hugovk changed the title Doc: POC of rendering version/language selector on Read the Docs Doc: Render version/language selector on Read the Docs Apr 17, 2024
@hugovk hugovk merged commit ae8dfd2 into python:main Apr 17, 2024
25 checks passed
@hugovk hugovk added the needs backport to 3.12 bug and security fixes label Apr 18, 2024
@miss-islington-app
Copy link

Thanks @humitos for the PR, and @hugovk for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Apr 18, 2024
(cherry picked from commit ae8dfd2)

Co-authored-by: Manuel Kaufmann <humitos@gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented Apr 18, 2024

GH-118038 is a backport of this pull request to the 3.12 branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants