Send <html lang> og <head> med igen

ASCII-hilsenen til view-source-læserne stod før <html>, og så smed Astros
compiler både <html>- og <head>-tagget væk. Browserne gættede sig til
resten, men lang-attributten har manglet på hele sitet siden juni. Hilsenen
står nu som første linje i <head>.

Claude-Session: https://claude.ai/code/session_012LCTmU2ewo8tnM1dByYAoG
This commit is contained in:
Asger Geel Weirsøe
2026-10-04 07:28:09 +02:00
parent 61d3d0584e
commit 2915d0a928
+9 -5
View File
@@ -17,11 +17,17 @@ interface Props {
tags?: string[];
jsonLd?: unknown[];
noindex?: boolean;
lang?: 'da' | 'en';
alternates?: { lang: 'da' | 'en'; path: string }[];
}
const { title, description, image, type, publishedTime, modifiedTime, tags, jsonLd, noindex } = Astro.props;
const { title, description, image, type, publishedTime, modifiedTime, tags, jsonLd, noindex, lang, alternates } = Astro.props;
---
<!doctype html>
<Fragment set:html={`<!--
<html lang={lang ?? SITE.lang}>
<head>
{/* Hilsenen skal stå INDE i <head>. Stod den før <html>, smed Astros compiler
både <html> og <head> væk, og sitet mistede lang-attributten (juni-okt. 2026). */}
<Fragment set:html={`<!--
_ ____ ____ _____ ____
/ \\ / ___| / ___| ____| _ \\
/ _ \\ \\___ \\| | _| _| | |_) |
@@ -32,8 +38,6 @@ const { title, description, image, type, publishedTime, modifiedTime, tags, json
Statisk Astro, ingen frameworks, self-hosted på Proxmox.
Prøv Cmd/Ctrl+K.. eller den gamle kode: op op ned ned venstre højre venstre højre B A.
-->`} />
<html lang={SITE.lang}>
<head>
<script is:inline>
(() => {
const apply = () => {
@@ -52,7 +56,7 @@ const { title, description, image, type, publishedTime, modifiedTime, tags, json
});
})();
</script>
<Head {title} {description} {image} {type} {publishedTime} {modifiedTime} {tags} {jsonLd} {noindex} />
<Head {title} {description} {image} {type} {publishedTime} {modifiedTime} {tags} {jsonLd} {noindex} {lang} {alternates} />
<ClientRouter />
<!-- Registrér service worker'en (PWA/offline). Genereret af @vite-pwa i build;
is:inline + public-sti så Astro ikke bundler den. 404 i dev = harmløst. -->