From 47282f3c300cb7b59a48a14115cb774d6ae4d6fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Lohrer?= Date: Tue, 28 Apr 2026 09:25:59 +0200 Subject: [PATCH] fix(deploy): __HTML_LANG__-substitution pro detail-HTML MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Begleiter zu app.html-aenderung in bb9d350, die auf __HTML_LANG__ umgestellt hat. Deploy-skript leitet den lang-wert pro /index.html aus snapshot/output/posts/.json ab (grep nach "lang"-feld im JSON), faellt sonst auf 'de' zurueck. Spec-§3.2: aus snapshot.lang. Vorher hartcodiert "de", was englische posts (z.B. bible-selfies) crawlern als deutschsprachig auswies — google search console hat das als lang-mismatch geflagt, screen reader sprechen englischen body mit deutscher engine. Co-Authored-By: Claude Opus 4.7 (1M context) --- scripts/deploy-svelte.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/scripts/deploy-svelte.sh b/scripts/deploy-svelte.sh index a00db9d..90b5fdb 100755 --- a/scripts/deploy-svelte.sh +++ b/scripts/deploy-svelte.sh @@ -110,6 +110,23 @@ find "$BUILD_DIR" -type f -name "*.html" -print0 | while IFS= read -r -d '' html sed -i '' "s|__SITE_URL__|$SITE_URL|g" "$html_file" done +# __HTML_LANG__-Platzhalter pro detail-HTML aus dem snapshot-JSON ableiten: +# //index.html → snapshot/output/posts/.json → .lang +# Alle anderen HTMLs (index, archiv/, impressum/, tag/) bekommen den +# default 'de' — die SPA setzt activeLocale clientseitig nach. +echo "Patche __HTML_LANG__ pro HTML aus snapshot/output …" +find "$BUILD_DIR" -type f -name "index.html" -print0 | while IFS= read -r -d '' html_file; do + rel="${html_file#$BUILD_DIR/}" + slug="${rel%/index.html}" + lang_file="$SNAPSHOT_DIR/posts/${slug}.json" + if [ -f "$lang_file" ]; then + lang=$(grep -o '"lang": *"[a-z][a-z]"' "$lang_file" | head -1 | sed 's/.*"\([a-z][a-z]\)".*/\1/') + else + lang="de" + fi + sed -i '' "s|__HTML_LANG__|${lang:-de}|g" "$html_file" +done + echo "Ziel: $TARGET ($PUBLIC_URL)" echo "Lade Build von $BUILD_DIR nach ftp://$FTP_HOST$FTP_REMOTE_PATH"