From 7afb509185f543ef8485c95d159d157aa4e2c5b8 Mon Sep 17 00:00:00 2001 From: Matt McKay Date: Mon, 3 Aug 2026 11:11:42 +1000 Subject: [PATCH 1/2] Enable the language switcher for the Farsi 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 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) --- lectures/_config.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lectures/_config.yml b/lectures/_config.yml index 32a45e7..dbd28bc 100644 --- a/lectures/_config.yml +++ b/lectures/_config.yml @@ -32,6 +32,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: fa authors: - name: Thomas J. Sargent url: http://www.tomsargent.com/ From 42577c58564496b11d616ec209c8a26c96fd2791 Mon Sep 17 00:00:00 2001 From: Matt McKay Date: Mon, 3 Aug 2026 11:23:11 +1000 Subject: [PATCH 2/2] Point the site URLs at the GitHub Pages address actually served MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- lectures/_config.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lectures/_config.yml b/lectures/_config.yml index dbd28bc..f665bf9 100644 --- a/lectures/_config.yml +++ b/lectures/_config.yml @@ -8,7 +8,7 @@ execute: timeout: 600 # 10 minutes html: - baseurl: https://python-programming-fa.quantecon.org/ + baseurl: https://quantecon.github.io/lecture-python-programming.fa/ latex: latex_documents: @@ -55,7 +55,8 @@ sphinx: header_organisation_url: https://quantecon.org header_organisation: QuantEcon repository_url: https://github.com/QuantEcon/lecture-python-programming.fa - nb_repository_url: https://github.com/QuantEcon/lecture-python-programming.fa.notebooks + # 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 @@ -74,8 +75,8 @@ sphinx: index_toc.md: intro.md tojupyter_static_file_path: ["source/_static", "_static"] tojupyter_target_html: true - tojupyter_urlpath: "https://python-programming-fa.quantecon.org/" - tojupyter_image_urlpath: "https://python-programming-fa.quantecon.org/_static/" + tojupyter_urlpath: "https://quantecon.github.io/lecture-python-programming.fa/" + tojupyter_image_urlpath: "https://quantecon.github.io/lecture-python-programming.fa/_static/" tojupyter_lang_synonyms: ["ipython", "ipython3", "python"] tojupyter_kernels: python3: