Skip to content

Build 404 template patterns: hero, related routes, and Display token (LS-2596) - #42

Merged
brandonmarshal merged 5 commits into
developfrom
feature/ls-2596-404-template-patterns
Sep 4, 2026
Merged

Build 404 template patterns: hero, related routes, and Display token (LS-2596)#42
brandonmarshal merged 5 commits into
developfrom
feature/ls-2596-404-template-patterns

Conversation

@brandonmarshal

@brandonmarshal brandonmarshal commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Builds the 404 template's main content out of the placeholder search-field pattern it had before: a hero with a large "404" numeral, a not-found heading, description, and Homepage/Search CTAs, plus a new "Five useful destinations" related-routes section.

Hero

  • Rebuilt patterns/template-404.php in place: large 404 numeral, H1 not-found heading, supporting copy, and Homepage/Search CTAs (Go to the homepage -> home_url('/'), Search the site -> home_url('/?s=')), replacing the previous minimal search-field version.
  • The numeral needed a font size larger than the theme's existing scale tops out at (900 / 4.5rem). Added a new 1000 ("Display") font-size preset to styles/presets/typography.json (fluid 4.5rem-10rem) rather than hardcoding a one-off size in the pattern.
  • Added the effect.watermark.brand semantic colour token to theme.json and styles/dark.json for the numeral's colour, backed by two new palette presets (brand-450, cta-150) rather than a raw hex or color-mix() value in the semantic token, per design-token-policy.instructions.md. Both pairings clear the 3:1 contrast minimum for large/decorative text against their canvas colour (light 3.61:1, dark 15.4:1).

Related routes

  • Added patterns/sections/404-best-next-routes.php: eyebrow, heading, and a 5-card grid (Homepage, Pricing, Website packages, FAQ, Contact) reusing the existing Card - Category style, is-style-link-arrow-accent, and is-style-content-band — no new block/section styles needed. Card icons are inline Phosphor "regular" SVGs (outermost/icon-block reads its icon from serialized HTML content, not the iconName attribute alone).
  • Wired into templates/404.html alongside the existing 404 pattern.
  • The section previously rendered with no gap before the footer; is-style-content-band supplies that via padding rather than margin, since WordPress core zeroes margin-top on template-part wrappers, which defeats the root blockGap sibling rule.
  • Fixed a Gutenberg editor crash on this block caused by an invalid core/group layout type ("flow" isn't a real layout type; corrected to "default").

Content

  • Created the FAQ page (/faq/) on the dev site so the FAQ card has a real destination; other cards link to existing dev-site pages (/pricing/, /website-packages/, /contact/).

Test plan

  • php -l clean on both changed/new pattern files
  • vendor/bin/phpcs --standard=WordPress — zero findings on both files
  • npm run patterns:escape — clean on both files
  • npm run security:scan — clean on both files
  • npm run schema:validate — all JSON passes
  • npm run theme:validate — the one failure (styles/light.json missing) is confirmed pre-existing on develop, unrelated to this branch
  • Manual visual QA in the Site Editor (light and dark)

Closes lightspeedwp/tour-operator#1296

brandonmarshal and others added 4 commits September 3, 2026 13:40
…ark token (LS-2596)

New patterns
- Add "Section - 404 Best Next Routes" pattern (patterns/sections/404-best-next-routes.php): eyebrow, heading, and a 5-card grid (Homepage, Pricing, Website packages, FAQ, Contact) using the existing Card - Category style and Phosphor icons
- Rebuild patterns/template-404.php in place: faded 404 watermark, heading, description, and Homepage/Search CTAs
- Wire both patterns into templates/404.html

Tokens
- Add custom.color.effect.watermark.brand to theme.json (brand-500) and styles/dark.json (brand-300) for the 404 numeral's tinted background treatment, matching the existing effect.hero.* token pattern

Fixes
- Use is-style-content-band on the routes section for top/bottom padding, since WordPress core zeroes margin-top on template-part wrappers and blockGap alone can't create space before the footer
- Embed real Phosphor "regular" SVG markup in each card's icon-block (house, tag, package, question, envelope-simple) — outermost/icon-block is a static block that requires inline SVG in .icon-container, not just an iconName attribute
- Increase the 404 numeral to a responsive clamp() size so it reads larger than all other text on the page

Content
- Create the FAQ page (/faq/) on the dev site so the FAQ card has a real destination
- Link cards to real dev-site URLs (home, /pricing/, /website-packages/, /faq/, /contact/)

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Fix
- Replace the effect.watermark.brand token's initial brand-500/brand-300
  mapping with the requested colours, added as proper palette presets
  (brand-450 #3D7DFF light, cta-150 #99EFFF dark) and referenced via
  var:preset|color|... per design-token-policy.instructions.md
…LS-2596)

Fix
- Change the wrapper group's layout type from "flow" (not a real
  core/group layout type) to "default" in
  patterns/sections/404-best-next-routes.php, which was crashing the
  block in the editor with a React error boundary
…2596)

Fix
- Replace the 404 numeral's hardcoded clamp() font-size with a proper
  typography token: add the "1000" (Display) font-size preset to
  styles/presets/typography.json (fluid 4.5rem-10rem) and reference it
  via fontSize:"1000" in patterns/template-404.php

Documentation
- Add CHANGELOG.md entry for LS-2596 covering the new related-routes
  pattern, the watermark token/presets, the template-404 rebuild, and
  the gap/icon/layout-crash fixes made during this branch
@brandonmarshal brandonmarshal added area:theme Theme & styles (templates, template parts, FSE) comp:block-patterns Patterns library/registration comp:theme-json Tokens, presets, settings comp:typography Type scale/fluids lang:json JSON config/content lang:php PHP code priority:normal Default priority for most issues. status:needs-review Awaiting code review labels Sep 3, 2026
@linear-code

linear-code Bot commented Sep 3, 2026

Copy link
Copy Markdown

LS-2596

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new 404 related-routes section is rendered outside the existing <main> landmark (introduced by the template wiring), which is a semantic/accessibility issue that should be resolved before approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR rebuilds the theme’s 404 experience by replacing the minimal 404 main-content pattern with a more structured hero layout and adding a “best next routes” section, supported by new typography and colour tokens in the theme’s design system.

Changes:

  • Rebuilt the 404 main-content pattern with a large “404” display numeral, heading, supporting copy, and Homepage/Search CTAs.
  • Added a new 404 related-routes section pattern and wired it into the 404 template.
  • Extended design tokens with a new “Display” font-size preset plus new palette entries and a semantic watermark colour token (light + dark mappings).
File summaries
File Description
theme.json Adds new palette entries and the effect.watermark.brand semantic colour token used by the 404 numeral.
templates/404.html Adds the related-routes section pattern to the 404 template.
styles/presets/typography.json Adds the 1000 (“Display”) fluid font-size preset used for the 404 numeral.
styles/dark.json Adds the dark-mode mapping for effect.watermark.brand.
patterns/template-404.php Rebuilds the 404 main-content pattern (hero + CTAs) and applies the new tokens.
patterns/sections/404-best-next-routes.php Introduces the “Five useful destinations” section pattern with a 5-card grid.
CHANGELOG.md Documents the additions/changes/fixes for LS-2596 under Unreleased.
Review details
  • Files reviewed: 7/7 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread templates/404.html Outdated
Comment thread patterns/sections/404-best-next-routes.php Outdated
…2596)

Fix
- Move the 404-best-next-routes pattern reference into
  patterns/template-404.php before </main> instead of templates/404.html,
  so it renders inside the main landmark like every other template's
  related-routes section (matches template-work-archive.php's convention)
- Add verticalAlignment:"center" to the routes section's eyebrow flex
  row, matching work-related-routes.php, so the dot icon aligns with
  the label text
@brandonmarshal
brandonmarshal merged commit 4d29d7b into develop Sep 4, 2026
1 of 3 checks passed
@brandonmarshal
brandonmarshal deleted the feature/ls-2596-404-template-patterns branch September 4, 2026 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:theme Theme & styles (templates, template parts, FSE) comp:block-patterns Patterns library/registration comp:theme-json Tokens, presets, settings comp:typography Type scale/fluids lang:json JSON config/content lang:php PHP code priority:normal Default priority for most issues. status:needs-review Awaiting code review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build 404 template

3 participants