Skip to content

feat(layouts): consolidate topic page layouts#18198

Open
myelinated-wackerow wants to merge 4 commits into
devfrom
feat/topic-layout-refactor
Open

feat(layouts): consolidate topic page layouts#18198
myelinated-wackerow wants to merge 4 commits into
devfrom
feat/topic-layout-refactor

Conversation

@myelinated-wackerow
Copy link
Copy Markdown
Collaborator

@myelinated-wackerow myelinated-wackerow commented May 15, 2026

Summary

Folds Staking, UseCases, Roadmap, and Upgrade markdown layouts into a single async server TopicLayout driven by per-topic config in src/data/topics/<key>.ts. Each section becomes a small config file (translation namespace, dropdown items, hero dimensions, edit banner) instead of a near-duplicate layout component. The four old layout files become MDX component bundles only and move to src/components/MdComponents/topics/.

Companion changes in the same PR:

  • Migrates 375 markdown files (15 EN + 360 translations across 24 locales) from summaryPoint1..4 to a single summaryPoints array; drops the dead emoji frontmatter field. Safe to land as a flat find-replace because none of the touched paths are ingested by the intl-pipeline yet (verified via .manifests/public/content/ check).
  • Hoists the Codeblock-wrapped Pre handler -- previously duplicated inline in Docs and Tutorial layouts -- into MdComponents.htmlElements as the site-wide default for fenced code blocks.

Behavior preservation

Dropdown labels, Matomo event names/categories, hero image dimensions, the edit banner (UseCases topic), and Staking's community callout are preserved verbatim. The community callout is passed as an afterContent slot prop by the slug router for template: staking pages.

Related

Test plan

  • /staking/, /staking/solo/, /staking/saas/, /staking/pools/, /staking/withdrawals/ render with the staking dropdown, hero, and the community callout below content
  • All /use-cases/ subpages render with the use-cases dropdown, hero, and the "edit this page" banner
  • /roadmap/security/, /roadmap/scaling/, /roadmap/user-experience/, /roadmap/future-proofing/ render with the roadmap dropdown
  • /roadmap/beacon-chain/ and /roadmap/merge/ (template: upgrade) render with the upgrade dropdown and show "page last updated: ..." under the summary list
  • Spot-check one non-English locale (e.g. /es/staking/solo/) -- dropdown labels translate
  • Spot-check one RTL locale (e.g. /ar/staking/solo/) -- layout is correctly mirrored
  • Pages with fenced code blocks (e.g. /developers/docs/getting-started/) still render with syntax highlighting and the copy-to-clipboard widget

🤖 Generated with Claude Code

myelinated-wackerow and others added 3 commits May 15, 2026 03:37
Folds Staking, UseCases, Roadmap, and Upgrade into a single async server TopicLayout. Per-topic config (translation namespace, dropdown items, hero dimensions, edit banner) lives in src/data/topics/. Old layout files become MDX component bundles only and move to src/components/MdComponents/topics/.

Consolidates the four per-section Frontmatter interfaces plus SummaryPointsNumbered into TopicFrontmatter, and deletes the now-unused getSummaryPoints helper.

Behavior preserved: dropdown items, Matomo events, hero dimensions, edit banner (UseCases topic), Staking community callout (passed as afterContent slot by the slug router).

Translatathon untouched; pending its redirect-to-/contributing deletion in a separate PR.

See docs/topic-layout-refactor.md.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: wackerow <54227730+wackerow@users.noreply.github.com>
Rewrites summaryPoint1..4 frontmatter fields into a single summaryPoints array across 15 EN markdown files plus their on-disk translations (~360 files, 24 locales).

Also drops the dead emoji frontmatter field, verified unused in any topic layout or hero component.

Possible only because none of the touched paths were ingested by the intl-pipeline yet (.manifests/public/content/ check confirms no entries). The migration is a flat find-replace on EN + translations rather than a pipeline-coordinated change.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: wackerow <54227730+wackerow@users.noreply.github.com>
Hoists the Codeblock-wrapped Pre handler (previously duplicated inline in Docs and Tutorial layouts) into MdComponents.htmlElements as the site-wide default for fenced code blocks. Topic, Static, and other markdown-content layouts now get syntax highlighting and the copy-to-clipboard widget for free.

Drops the duplicate inline definitions from src/layouts/Docs.tsx and src/layouts/Tutorial.tsx.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: wackerow <54227730+wackerow@users.noreply.github.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented May 15, 2026

Deploy Preview for ethereumorg ready!

Name Link
🔨 Latest commit 4f898f9
🔍 Latest deploy log https://app.netlify.com/projects/ethereumorg/deploys/6a070a96439e110009431197
😎 Deploy Preview https://deploy-preview-18198.ethereum.it
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
7 paths audited
Performance: 66 (🟢 up 1 from production)
Accessibility: 95 (🔴 down 1 from production)
Best Practices: 100 (no change from production)
SEO: 98 (🔴 down 1 from production)
PWA: 59 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added content 🖋️ This involves copy additions or edits tooling 🔧 Changes related to tooling of the project translation 🌍 This is related to our Translation Program labels May 15, 2026
@wackerow wackerow removed the translation 🌍 This is related to our Translation Program label May 15, 2026
Adds the canonical-layouts reference and a top-level rule in the design-system skill so future agents reach for a TopicLayout config (src/data/topics/<key>.ts) before creating a new layout component. The default should be "configure, don't add new" for any page that fits the topic-hub-with-sub-nav pattern.

- references/layouts.md: full inventory of the six canonical layouts (TopicLayout, StaticLayout, DocsLayout, TutorialLayout, ContentLayout, BaseLayout), worked example for adding a new topic, and the cases where a new layout is actually warranted.
- SKILL.md: top rule #11 surfacing the guidance up front, plus a references-table entry pointing to layouts.md.
- references/cleanup-playbook.md: "per-section layout -> TopicLayout config" entry with before/after, so agents auditing legacy code know the canonical replacement.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: wackerow <54227730+wackerow@users.noreply.github.com>
@github-actions github-actions Bot added the translation 🌍 This is related to our Translation Program label May 15, 2026
Copy link
Copy Markdown
Member

@pettinarip pettinarip left a comment

Choose a reason for hiding this comment

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

@myelinated-wackerow great work overall!

...props
}: ContentLayoutProps) => {
return (
<div {...props}>
{editBanner}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is a parent implementation problem that should live here. This banner or whatever the parent want to render should probable be part of heroSection and keep the API clean. Small issue but leaves an unnecessary prop imo

Comment thread src/layouts/index.ts
"use-cases": TopicLayout,
staking: TopicLayout,
roadmap: TopicLayout,
upgrade: TopicLayout,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nice

if (topicConfig) {
const afterContent =
layout === "staking" ? (
<StakingCommunityCallout className="my-16" />
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

sidecomment, we should probably need to think about a global callout component (in base layout perhaps) to be used for any page that needs something like this

config={topicConfig}
afterContent={afterContent}
>
{content}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

instead of adding a new prop afterContent we could just do

Suggested change
{content}
{content}
{afterContent}

},
],
},
heroImage: { width: 1456, height: 816 },
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd strip this heroImage data from here. This is a UI related data that the Layout knows better the size of the hero image to be displayed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

content 🖋️ This involves copy additions or edits tooling 🔧 Changes related to tooling of the project translation 🌍 This is related to our Translation Program

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants