Skip to content

Unit 5: fix double <head> in baseof + consolidate theme-init script#7

Open
stradichenko wants to merge 1 commit intomainfrom
unit-05-baseof-fix-double-head-consolidate-theme-init
Open

Unit 5: fix double <head> in baseof + consolidate theme-init script#7
stradichenko wants to merge 1 commit intomainfrom
unit-05-baseof-fix-double-head-consolidate-theme-init

Conversation

@stradichenko
Copy link
Copy Markdown
Owner

Summary

  • Resolve the double <head> opening: baseof.html owns <head>...</head>, and partials/head/* partials now emit children only.
  • Drop the inline theme-init <script> from baseof.html. head/critical-css.html injects assets/js/critical.js via safeJS, so that's the single source.
  • Externalize the in-template main.css resource pipeline (delegated to head/styles.html). Move the mermaid module loader into partials/head/mermaid.html gated on .Store.Get "hasMermaid". Move the inline math-reprocess script into assets/js/math-init.js.
  • Duplicate inline copies in head/critical-css.html and head/js.html are removed in Unit 6.

Notes for reviewer

  • ⚠️ Conflicts with Unit 11 on baseof.html: Unit 11 removes the {{ partial "math.html" . }} block since math.html is deleted. Resolve by taking Unit 11's deletion (KaTeX-only).

Test plan

  • Built HTML has exactly one <head> opening tag.
  • No FOUC: data-theme is set before first paint.
  • <head>...</head> is well-formed in all generated pages.

Part of the PKB-theme modernization batch (15 units).

- baseof.html owns <head>...</head>; partials/head/* now emit children only.
- Drop the inline theme-init <script> from baseof.html. critical-css.html
  injects assets/js/critical.js via safeJS, so that's the single source.
- Externalize the in-template main.css resource pipeline; head/styles.html
  is the owner.
- Move the mermaid module loader into a tiny partials/head/mermaid.html,
  gated on .Store.Get "hasMermaid".
- Move the inline math-reprocess script into assets/js/math-init.js.
  (Unit 11 wires KaTeX; this just stops baseof from inlining it.)
- assets/js/critical.js is the single source of truth for the theme-init
  logic. Duplicated inline copies in head/critical-css.html and head/js.html
  are removed in Unit 6.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant