From 83f933010ec783603bbe7e327196db9efd592a5f Mon Sep 17 00:00:00 2001 From: Tobias Leinss <7684178+leinss@users.noreply.github.com> Date: Tue, 18 Aug 2026 11:33:17 +0200 Subject: [PATCH] feat(blog): remember the chosen post language across visits The blog index toggles between English and German panels client-side but reset to English on every visit, so a German reader re-selected the language on every arrival. The theme already persists; the language now does too. - Store the choice under `blogLang` on click and restore it on init - Only restore a language that still has a panel, so a stored value that outlives its posts cannot hide every panel and leave an empty page - Guard reads and writes: localStorage throws rather than returning null when a browser blocks storage, and a toggle that stops working is worse than one that forgets --- src/pages/blog/index.astro | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/src/pages/blog/index.astro b/src/pages/blog/index.astro index 137b6b9fc..bbb2ef610 100644 --- a/src/pages/blog/index.astro +++ b/src/pages/blog/index.astro @@ -93,6 +93,28 @@ const sections = langsWithPosts.map((lang) => ({