Enable the language switcher and fix this edition's site URLs - #145
Merged
Conversation
Mirrors QuantEcon/lecture-python-programming#490, which adds the same block to the English source. Lists all four editions with current_language set to fa so this edition renders as active, and injects the hreflang alternates for the set. English stays first in the list because the theme uses languages[0] as the hreflang x-default target. Verified with a local build against the theme: the switcher lists all four languages with fa active. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
✅ Deploy Preview for majestic-griffin-10b166 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
There was a problem hiding this comment.
🟢 Ready to approve
The change is a small, self-contained theme configuration update that mirrors the known upstream pattern and does not alter any runtime code paths.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
This PR enables the QuantEcon Book Theme language switcher for the Farsi (fa) edition by adding the theme’s languages configuration and setting current_language: fa in the Jupyter Book/Sphinx config.
Changes:
- Add
html_theme_options.languagesentries for en/fa/fr/zh-cn with their public URLs. - Set
html_theme_options.current_language: faso the switcher correctly marks فارسی as active.
File summaries
| File | Description |
|---|---|
lectures/_config.yml |
Adds the language-switcher configuration block and sets the current language to Farsi for this edition. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
baseurl claimed https://python-programming-fa.quantecon.org/, a host that does not resolve, so every page emitted a canonical and og:url to a dead address while the site serves from github.io. The two tojupyter paths carried the same dead host. This edition is hosted at its GitHub Pages URL while the broader URL structure is decided, so the config now says so. Also drops nb_repository_url, which pointed at lecture-python-programming.fa.notebooks — a repository that does not exist. Mirrors the comment the fr edition already uses; the theme skips notebook-launch links when the option is unset. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two related changes: enable the language switcher, and point this edition's URLs at the address it is actually served from. The second is a prerequisite for the first to be worth anything, which is why they are together — see below.
1. Language switcher
Adds the switcher configuration to
html_theme_options, mirroring QuantEcon/lecture-python-programming#490 which adds the same block to the English source.enfafrzh-cncurrent_language: fa, so this edition renders as active. English stays first because the theme useslanguages[0]as thehreflangx-defaulttarget.This does not propagate from the English source: the sync workflows trigger only on
lectures/**/*.mdandlectures/_toc.yml, so_config.ymlnever reaches a sync run, and each edition needs its owncurrent_languageanyway.2. Site URLs
html.baseurlwashttps://python-programming-fa.quantecon.org/, and that host does not resolve — DNS fails. Every page emitted acanonicaland anog:urlpointing at a dead address, while the site actually serves fromhttps://quantecon.github.io/lecture-python-programming.fa/. Bothtojupyter_urlpathandtojupyter_image_urlpathcarried the same dead host, so generated notebooks resolved their links and images there too.This edition is hosted at its GitHub Pages URL while the broader URL structure is worked out, so all three now say that.
This matters for part 1 rather than being incidental to it. Search engines reconcile
hreflangagainst each page's canonical; with the canonical pointing somewhere unreachable, the annotations could not form a valid cluster and the SEO half of the switcher would have been inert.Also drops
nb_repository_url, which pointed atlecture-python-programming.fa.notebooks— a repository that does not exist. Replaced with the same explanatory comment thefredition already carries; the theme omits notebook-launch links when the option is unset, which is how.frruns in production today.Verification
Built locally against
quantecon-book-theme==0.21.0, which this repo already pins:dir="rtl"is preserved on<body>—enable_rtl: Trueis untouched.hreflangalternates inject, includingx-default→ en.canonicalandog:urlnow readhttps://quantecon.github.io/lecture-python-programming.fa/{page}.html, matching this edition's ownhreflangself-reference. That agreement is what makes the cluster coherent.Note
Nothing here changes a live page until a
publish*tag is pushed. This edition last published on 2026-06-19.