From ebcbe2454fea0515d5419028efa10e31942ebd2a Mon Sep 17 00:00:00 2001 From: Vivek Date: Wed, 22 Jul 2026 17:06:25 +0530 Subject: [PATCH] fix: share the site footer between the home and /why pages The full marketing footer lived only in app/page.ts, so /why rendered without it. Extract it into lib/site-footer.ts and render it on both pages so the site reads as one system. Section anchors now use /#id so they resolve from any page, not only home. Closes #1044 --- website/app/page.ts | 46 ++--------------------------- website/app/why/page.ts | 3 ++ website/lib/site-footer.ts | 59 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+), 43 deletions(-) create mode 100644 website/lib/site-footer.ts diff --git a/website/app/page.ts b/website/app/page.ts index 260059920..71ed19c02 100644 --- a/website/app/page.ts +++ b/website/app/page.ts @@ -2,7 +2,8 @@ import { html } from '@webjsdev/core'; import '#components/copy-cmd.ts'; import '#components/like-button.ts'; import { COMPONENT_SAMPLE, ACTION_SAMPLE, PAGE_SAMPLE } from '#lib/samples.ts'; -import { DOCS_URL, UI_URL, EXAMPLE_BLOG_URL, GH_URL, DISCORD_URL, NEW_TAB } from '#lib/links.ts'; +import { DOCS_URL, GH_URL, NEW_TAB } from '#lib/links.ts'; +import { siteFooter } from '#lib/site-footer.ts'; // highlight() runs only at SSR (codeWindow renders its output into the served // HTML), but it does ship to the client as a small dead module: the page loads // in the browser to register copy-cmd, and that pulls in its @@ -400,47 +401,6 @@ middleware.ts - + ${siteFooter()} `; } diff --git a/website/app/why/page.ts b/website/app/why/page.ts index 581163900..56fcea097 100644 --- a/website/app/why/page.ts +++ b/website/app/why/page.ts @@ -1,6 +1,7 @@ import { html } from '@webjsdev/core'; import '#components/copy-cmd.ts'; import { DOCS_URL, GH_URL, EXAMPLE_BLOG_URL, NEW_TAB } from '#lib/links.ts'; +import { siteFooter } from '#lib/site-footer.ts'; /** * /why @@ -211,5 +212,7 @@ Counter.register('counter'); + + ${siteFooter()} `; } diff --git a/website/lib/site-footer.ts b/website/lib/site-footer.ts new file mode 100644 index 000000000..cd6b66342 --- /dev/null +++ b/website/lib/site-footer.ts @@ -0,0 +1,59 @@ +import { html } from '@webjsdev/core'; +import { DOCS_URL, UI_URL, EXAMPLE_BLOG_URL, GH_URL, DISCORD_URL, NEW_TAB } from '#lib/links.ts'; + +/** + * The site-wide footer, shared across marketing pages (the home page and /why). + * + * It lives here rather than inline in a page so every page renders the same + * chrome. Pure SSR-time helper: it returns an `html` fragment and touches no + * client globals, so importing it never ships a page to the browser. + * + * Anchor links point at `/#` (not a bare `#`) so a section anchor + * resolves from any page, not only the home page. + */ +export function siteFooter() { + return html` + + `; +}