Skip to content

Unit 6: head/* partials — drop duplicates, externalize KaTeX & inline CSS#8

Open
stradichenko wants to merge 1 commit intomainfrom
unit-06-head-partials-cleanup
Open

Unit 6: head/* partials — drop duplicates, externalize KaTeX & inline CSS#8
stradichenko wants to merge 1 commit intomainfrom
unit-06-head-partials-cleanup

Conversation

@stradichenko
Copy link
Copy Markdown
Owner

Summary

  • head.html: drop the inline duplicated theme-init <script>. Drop the hardcoded KaTeX <script>/<link> block (Unit 11 wires KaTeX from assets/js/katex-init.js, gated on .Params.math, with SRI).
  • head/critical-css.html: drop the duplicate inline theme-init script; keep only the safeJS injection of critical.js. Move the inline selection-highlight <style> into assets/css/critical.css.
  • head/js.html: collapse the three repeated resources.Get blocks (main.js / pdf-generator.js / scrollbar-fade.js) into a single range loop. Drop the duplicated inline theme-init script.
  • head/styles.html: deduplicate the CSS bundle list. Gate theme-toggle.css, search.css, contribution-calendar.css per page. Replace resources.Minify aliasing with the | minify pipe.
  • head/meta.html: replace .Date.Format with time.Format. Move CSP into a configurable site.Params.security.csp param with a sane default; drop 'unsafe-eval' from the default.
  • seo/preload-resources.html: drop dead Google Fonts dns-prefetch/preconnect. seo/schema-org.html: replace safeJS on the social array with jsonify.

Notes for reviewer

  • ⚠️ Conflicts with Unit 9 on head.html: keep partialCached "analytics.html" (Unit 9's analytics dispatcher is invariant per site).

Test plan

  • Built <head> contains exactly one theme-init script.
  • No duplicate KaTeX loaders.
  • CSS bundle URL is fingerprinted.
  • No fonts.googleapis.com preconnect in built HTML.
  • No 'unsafe-eval' in the default CSP header.

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

- head.html: drop the inline duplicated theme-init <script>. Drop the
  hardcoded KaTeX <script>/<link> block (Unit 11 wires KaTeX from
  assets/js/katex-init.js, gated on .Params.math, with SRI).
- head/critical-css.html: drop the duplicate inline theme-init script;
  keep only the safeJS injection of critical.js. Move the inline
  selection-highlight <style> into assets/css/critical.css.
- head/js.html: collapse the three repeated resources.Get blocks for
  main.js / pdf-generator.js / scrollbar-fade.js into a single range
  loop. Drop the duplicated inline theme-init script.
- head/styles.html: deduplicate the CSS bundle list (Unit 7 fixes the
  single.html side). Gate theme-toggle.css, search.css,
  contribution-calendar.css per page. Replace resources.Minify aliasing
  with the | minify pipe.
- head/meta.html: replace .Date.Format with time.Format. Move CSP into
  a configurable site.Params.security.csp param with a sane default;
  drop 'unsafe-eval' from the default.
- seo/preload-resources.html: drop dead Google Fonts dns-prefetch /
  preconnect (no Google Fonts loaded). Use | minify.
- seo/schema-org.html: replace safeJS on the social array with jsonify.
  Replace .Date.Format with time.Format.
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