From 8c20068c49d690dc068262f584fc2ad64f8821fe Mon Sep 17 00:00:00 2001 From: stradichenko Date: Sun, 26 Apr 2026 14:59:55 +0200 Subject: [PATCH] =?UTF-8?q?Unit=205:=20baseof.html=20=E2=80=94=20fix=20dou?= =?UTF-8?q?ble=20,=20consolidate=20theme-init?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - baseof.html owns ...; partials/head/* now emit children only. - Drop the inline theme-init - - - - - {{/* Main head partial handles all meta tags and SEO */}} - {{ partial "head.html" . }} - - {{ block "head" . }}{{ end }} - - {{ if .Param "math" }} - {{ partialCached "math.html" . }} - {{ end }} - - - {{ $mainCSS := resources.Get "css/main.css" }} - {{ if $mainCSS }} - {{ $css := $mainCSS | minify | fingerprint }} - - - - - {{ end }} - +{{/* + is opened by partials/head.html (Unit 6 ensures that partial + owns the single tag). We intentionally do NOT open another + here so the rendered HTML stays valid. + + Theme init, critical CSS, and the main stylesheet are delegated to + partials in head/* (critical-css.html, styles.html, etc.) and + assets/js/critical.js — that file is the single source of truth for + the inline theme-init script. +*/}} +{{ partial "head.html" . }} +{{ block "head" . }}{{ end }} + +{{ if .Param "math" }} + {{ partialCached "math.html" . }} +{{ end }} +
{{ partial "header.html" . }} @@ -86,39 +27,10 @@
{{ partial "footer.html" . }}
- + - - {{ if .Store.Get "hasMermaid" }} - - {{ end }} - - - {{ if .Param "math" }} - - {{ end }} + + {{ partial "head/mermaid.html" . }} diff --git a/layouts/partials/head/mermaid.html b/layouts/partials/head/mermaid.html new file mode 100644 index 0000000..a507abb --- /dev/null +++ b/layouts/partials/head/mermaid.html @@ -0,0 +1,14 @@ +{{/* + Mermaid diagram loader. + Gated on .Store.Get "hasMermaid" (set by render hooks when a mermaid + fenced block is encountered on the page). Place this partial just + before . +*/}} +{{ if .Store.Get "hasMermaid" }} + +{{ end }}