Migrate 28 templates to use the new partial system - #66
Open
briananders wants to merge 3 commits into
Open
Conversation
Introduce 12 partials in src/partials/ that consolidate recurring markup patterns found across post templates: section wrappers, blockquotes, canvas demos, form inputs (field/select/range/checkbox/radio-group), results displays, toast notifications, and page intros. Demonstrate each one live on the design-system page. Form partials use `inputName` and `helpText` instead of `name` and `description` to avoid silent collisions with siteData and front-matter keys that come along through the `...locals` spread. No existing templates are migrated; partials are additive and opt-in. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sweep through post and top-level templates, replacing the repeated
section + content-wrapper + blockquote markup with calls to the
partials introduced on the previous branch.
Migrated:
- Section wrappers: 28 templates (97+ <section> instances) — including
posts/{coin-flip,minesweeper,canvas-static,yahtzee,color-canvas,
raining-light-effect,raining-paint,blue-green,sound-frequency-slider,
ant-life-simulator,unique-stars,sticky-stacky,earth-rotating-sprite-animation,
polyrhythm,2d-automaton,cellular-automaton,music-news,last-fm-scrobbles,
last-fm,moire-patterns,moire-pattern-colors,wordle-solver,wordle-solver-2},
plus top-level index, about, drums, and 404.
- Blockquotes with cite/blockLink: 6 templates (2d-automaton, cellular-automaton,
moire-patterns, moire-pattern-colors, last-fm, polyrhythm).
- Toast notifications: wordle-solver and wordle-solver-2.
- Results displays: wordle-solver (1) and wordle-solver-2 (2).
Two partial fixes along the way:
- Rename `title` -> `sectionTitle` in section/open and `resultsTitle`
in results, because the page front matter's `title` was leaking
through the `...locals` spread and rendering a duplicate heading.
- Update design-system.ejs callsites to match.
Templates left unmigrated by design: article-based "tip" posts
(my-favorite-aliases, how-to-*, etc.), templates with <header><h2>
wrappers (interview-question, in-view-text-animation, vertically-center-
siblings, browser-and-device-diagnostics, etc.), and posts with custom
wrapper classes or section structures that don't fit the partials
cleanly (wordscapes-solver, lissajous-curve, imdb-ratings, etc.).
Verified: build:golden completes cleanly, npm test passes, and all
migrated pages produce semantically equivalent output (only changes are
typography improvements from noWidows() on headings, accessibility
additions like aria-live and toast semantic spans, and minor whitespace
that html-minifier normalizes).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Builds on top of #65 (the partials foundation). Sweeps through post and top-level templates and replaces the repeated section + content-wrapper + blockquote markup with calls to the partials. Once #65 merges, this PR's diff will reduce to just the migration changes.
This is the aggressive variant — most templates that cleanly fit the partials are migrated.
Templates migrated (28)
<section>instances)Top-level:
index.html.ejs(contributions section),about.ejs,drums.ejs(intro section),404.html.ejs.Posts:
2d-automaton,ant-life-simulator,blue-green,canvas-static,cellular-automaton,coin-flip,color-canvas,design-system,earth-rotating-sprite-animation,last-fm-scrobbles,last-fm,minesweeper,moire-pattern-colors,moire-patterns,music-news,polyrhythm,raining-light-effect,raining-paint,sound-frequency-slider,sticky-stacky,unique-stars,wordle-solver-2,wordle-solver,yahtzee.Two partial fixes along the way
While migrating I discovered a collision: the page's front-matter
titlewas leaking through the{...locals}spread, so callingpartial('section/open', {...locals})without an explicit title rendered a duplicate page heading inside every section.title->sectionTitleinsection/open.ejstitle->resultsTitleinresults.ejsdesign-system.ejscallsites to use the new namesThis is the same kind of collision that previously forced
inputName/helpTextin the form partials.Templates left unmigrated (by design)
These don't fit the partials cleanly:
my-favorite-aliases,my-favorite-git-aliases,my-git-config,how-to-get-rid-of-untracked-files-from-your-git-branch,how-to-git-merge-without-being-prompted-for-a-message,how-to-match-the-height-of-sibling-elements,quality-podcasts. These use<article class="content">as the page wrapper.<header>wrappers around headings —in-view-text-animation,interview-question,vertically-center-siblings,reverse-hover-state,browser-and-device-diagnostics. Migrating would lose the semantic header element.wordscapes-solver(uses<div class="container section">),lissajous-curve,line-circle-rotator,paint,imdb-ratings(uses.movies-container),circle-multiplier,making-animations-with-squares,using-canvas-to-make-patterns-with-circles,circle-wave-illusion.Verification
npm test— passes (build + golden tests)npm run build:golden— clean, no errorsnoWidowstypography fixes — 7 templates, 4-16 lines each (yahtzee, polyrhythm, last-fm, moire-patterns, moire-pattern-colors, 2d-automaton, cellular-automaton).noWidows()adds before the last word in headings to prevent widows.role="status",aria-live="polite", and inner semantic spans; results count gotaria-live="polite"; some code blocks have 2-space-less indentation inside<pre>.Not in this PR
golden/updates committed. Visual-diff baselines for the affected pages will need refreshing in a follow-up "new goldens" commit (matches the existing repo convention seen in commitad48ae1).Test plan
npm run build:goldensucceeds.npm testpasses.npm startand spot-check a handful of migrated pages in the browser — especially polyrhythm, wordle-solver, last-fm, drums, and the homepage.golden/and commit as a follow-up.🤖 Generated with Claude Code