fix(deploy): __HTML_LANG__-substitution pro detail-HTML
Begleiter zu app.html-aenderung in bb9d350, die <html lang> auf
__HTML_LANG__ umgestellt hat. Deploy-skript leitet den lang-wert
pro <slug>/index.html aus snapshot/output/posts/<slug>.json ab
(grep nach "lang"-feld im JSON), faellt sonst auf 'de' zurueck.
Spec-§3.2: <html lang> 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) <noreply@anthropic.com>
This commit is contained in:
parent
bb9d35076d
commit
47282f3c30
|
|
@ -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:
|
||||
# /<slug>/index.html → snapshot/output/posts/<slug>.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"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue