From 18231bfa8be81473073ae33a3e36d05006ba56d3 Mon Sep 17 00:00:00 2001 From: Matt McKay Date: Mon, 3 Aug 2026 11:11:47 +1000 Subject: [PATCH 1/2] Enable the language switcher for the Chinese edition Mirrors QuantEcon/lecture-python-programming#490, which adds the same block to the English source. Lists all four editions with current_language set to zh-cn 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 zh-cn active. Co-Authored-By: Claude Opus 5 (1M context) --- lectures/_config.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lectures/_config.yml b/lectures/_config.yml index ddae340..9e3362d 100644 --- a/lectures/_config.yml +++ b/lectures/_config.yml @@ -34,6 +34,20 @@ sphinx: html_theme: quantecon_book_theme html_static_path: ['_static'] html_theme_options: + languages: + - code: en + name: English + url: https://python-programming.quantecon.org + - code: fa + name: فارسی + url: https://quantecon.github.io/lecture-python-programming.fa + - code: fr + name: Français + url: https://quantecon.github.io/lecture-python-programming.fr + - code: zh-cn + name: 中文 + url: https://quantecon.github.io/lecture-python-programming.zh-cn + current_language: zh-cn authors: - name: Thomas J. Sargent url: http://www.tomsargent.com/ From 1c8525050dcc304ac9d3aea30bf8909a73d78a81 Mon Sep 17 00:00:00 2001 From: Matt McKay Date: Mon, 3 Aug 2026 11:23:12 +1000 Subject: [PATCH 2/2] Point the site and repository URLs at this edition, not the English one Four settings were copied from the English config and never updated, so this edition advertised itself as the English site: - baseurl was https://python-programming.quantecon.org/, making every page emit a canonical and og:url declaring it a duplicate of the corresponding English page - repository_url sent "View Source" to the English repository - nb_repository_url pointed at the English notebooks - both tojupyter paths resolved notebook and image links to the English site baseurl and the tojupyter paths now use this edition's GitHub Pages address, which is where it is hosted while the broader URL structure is decided. repository_url points here. nb_repository_url is dropped rather than repointed, since no zh-cn notebooks repository exists; this mirrors the comment the fr edition already uses. Co-Authored-By: Claude Opus 5 (1M context) --- lectures/_config.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lectures/_config.yml b/lectures/_config.yml index 9e3362d..48f7841 100644 --- a/lectures/_config.yml +++ b/lectures/_config.yml @@ -8,7 +8,7 @@ execute: timeout: 600 # 10 minutes html: - baseurl: https://python-programming.quantecon.org/ + baseurl: https://quantecon.github.io/lecture-python-programming.zh-cn/ latex: latex_documents: @@ -56,8 +56,9 @@ sphinx: dark_logo: quantecon-logo-transparent.png header_organisation_url: https://quantecon.org header_organisation: QuantEcon - repository_url: https://github.com/QuantEcon/lecture-python-programming - nb_repository_url: https://github.com/QuantEcon/lecture-python-programming.notebooks + repository_url: https://github.com/QuantEcon/lecture-python-programming.zh-cn + # nb_repository_url omitted deliberately: no notebooks repo exists for this + # edition yet, and the theme skips notebook-launch links when it is unset path_to_docs: lectures twitter: quantecon twitter_logo_url: https://assets.quantecon.org/img/qe-twitter-logo.png @@ -80,8 +81,8 @@ sphinx: index_toc.md: intro.md tojupyter_static_file_path: ["source/_static", "_static"] tojupyter_target_html: true - tojupyter_urlpath: "https://python-programming.quantecon.org/" - tojupyter_image_urlpath: "https://python-programming.quantecon.org/_static/" + tojupyter_urlpath: "https://quantecon.github.io/lecture-python-programming.zh-cn/" + tojupyter_image_urlpath: "https://quantecon.github.io/lecture-python-programming.zh-cn/_static/" tojupyter_lang_synonyms: ["ipython", "ipython3", "python"] tojupyter_kernels: python3: