-
-
Notifications
You must be signed in to change notification settings - Fork 247
feat: Implement dynamic version dropdown and static language switcher #330
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
Conversation
|
Hi @OriolAbril, |
|
Thanks! I will try to review before the meeting tomorrow but there is high probability I won't be able. The video looks good and the modified lines summary of |
aterrel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Accepting this PR at the moment seems to make it so the live site will be pushing a switcher that goes to a 404. Can we fix that first?
|
Even if we fixed this I don't think it is ready to merge yet |
|
Hi @OriolAbril, when you get a chance, could you please review this? I believe I’ve addressed all your feedback and implemented the changes as discussed in proposal #334 |
…l configuration to enable automatic PR previews:- Configures build settings to match our GitHub Actions workflow- Sets publish directory to DISCOVER/_build/html- Configures Python 3.12 as the runtime environment- Ensures build command removes tags and rebuilds documentation- Disabled preview.yml workflow by commenting out trigger conditions
|
Hi @OriolAbril Could you please verify ?? |
OriolAbril
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great already, we have to coordinate in the next meeting to see how to "backport" part of these changes to 1.0 and 2.0 branches
|
I created a |
OriolAbril
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comments are so we can merge this and start backporting elements of this PR into the other versions.
|
Hi, @OriolAbril can you verify ? |
|
Hi @aterrel , Could you please add the |
|
Previously Screen.Recording.2025-08-05.185854.mp4Now Screen.Recording.2025-08-05.185351.mp4 |
|
@AR21SM you have to undo this commit fix: correct English URL structure in language switcher. There will be nothing at |
|
The styling is a good start, we can continue polishing in follow up PRs. If you want to open an issue or a discussion to get an idea/proposal on what we want to happen do not hesitate to do so then tag us. In my opinion, we should try to match the look and behaviour of https://pydata-sphinx-theme.readthedocs.io/en/stable/index.html as much as possible (we are using the compontent from the theme, but using a different theme, so it has many differences even if the core javascript to change the urls to matching ones is the same). |
DISCOVER/conf.py
Outdated
| "navigation_with_keys": False, | ||
| "show_version_warning_banner": True, | ||
| "switcher": { | ||
| "json_url": "https://discover-cookbook.numfocus.org/_static/versions.json", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There will be nothing at this url given the current pipeline. I would propose using https://discover-cookbook.numfocus.org/versions.json and copying the json into that path but only when deploying from main/next. Otherwise use https://discover-cookbook.numfocus.org/dev/en/_static/versions.json which will already exist.
Having these jsons inside _static could be a bit confusing because the static folder is copied for every build. That is url/dev/es/ will also have the _static folder with the two jsons, same for url/2.0/en/
Screen.Recording.2025-08-05.204644.mp4currently, it looks like this. I was thinking , should I reduce the font size (and box size) a bit and maybe add a little margin between the two buttons? Also, it’s placed at the left corner .Do you think that’s fine, or should I move it to the right or somewhere else? Open to any suggestions. |
* Add Netlify configuration for PR previewsThis commit adds netlify.toml configuration to enable automatic PR previews:- Configures build settings to match our GitHub Actions workflow- Sets publish directory to DISCOVER/_build/html- Configures Python 3.12 as the runtime environment- Ensures build command removes tags and rebuilds documentation- Disabled preview.yml workflow by commenting out trigger conditions * deleted preview.yml * added build.sh * updated workflows and netlify.toml file * Added dynamic version dropdown and static language switcher * fixed all proposed changes * updated build-gh-pages.yml * Fixed all Proposed changes * fix: correct English URL structure in language switcher * styled language switcher to match version switcher design * undoing the chnages --------- Co-authored-by: Andy R. Terrel <[email protected]>
* Add Netlify configuration for PR previewsThis commit adds netlify.toml configuration to enable automatic PR previews:- Configures build settings to match our GitHub Actions workflow- Sets publish directory to DISCOVER/_build/html- Configures Python 3.12 as the runtime environment- Ensures build command removes tags and rebuilds documentation- Disabled preview.yml workflow by commenting out trigger conditions * deleted preview.yml * added build.sh * updated workflows and netlify.toml file * Added dynamic version dropdown and static language switcher * fixed all proposed changes * updated build-gh-pages.yml * Fixed all Proposed changes * fix: correct English URL structure in language switcher * styled language switcher to match version switcher design * undoing the chnages --------- Co-authored-by: Andy R. Terrel <[email protected]>

Detailed Description:
Overview
This PR introduces a comprehensive multi-version and multi-language infrastructure for the DISCOVER Cookbook, enabling users to seamlessly navigate between different documentation versions and language translations through intuitive UI components.
Key Features Implemented
Dynamic Version Switcher
versions.jsondefining available versions with URL mapping and preferred version marking:[ { "version": "2.0", "url": "https://discover-cookbook.numfocus.org/2.0/", "preferred": true } ]sphinx-book-themeswitcher functionality with dynamic JSON URL loading:Multi-Language Support Infrastructure
languages.jsonsupporting multiple languages with locale names, text direction, and visibility control:[ { "code": "es", "name_local": "Español", "direction": "ltr", "hidden": true } ]Template System: Implemented
language-switcher.htmltemplate with Bootstrap dropdown functionalityContext Variables: Added comprehensive HTML context variables for language data, current language detection, and URL generation:
Build System Enhancements
Build Script: Created
ci/build_website.shfor streamlined build process.Added
destination_dir: dev/for development version deployment:This implementation establishes a robust foundation for the DISCOVER Cookbook's evolution into a multi-version, multi-language documentation platform while maintaining seamless user experience.