Adding a Marketing Page

Add a cached public page: where the file goes, what it must export, and how it links to the rest of the app.

A file in apps/web/pages/(marketing)/ is a marketing page: public, inside the marketing header and footer, and served from the edge cache to visitors without cookies.

This page is part of the Marketing documentation.

Steps

  1. Create the page: apps/web/pages/(marketing)/about.tsx is /about. The (marketing) folder doesn't appear in the URL.

  2. Create its server file with prerender and the head:

    // apps/web/pages/(marketing)/about.server.ts
    import { defineHead } from 'void';
    import { getServerTranslator } from '#/lib/i18n.server.ts';
    import { pageHead } from '#/lib/seo.server.ts';
    export const prerender = true;
    export const head = defineHead((c) => {
    const t = getServerTranslator({ c, namespace: 'marketing.about' });
    // the page's own path: canonical link, link previews, noindex-free
    return pageHead({
    path: '/about',
    title: t('title'),
    description: t('description'),
    });
    });

    No loader: the page shows repository content only. Every marketing page needs export const prerender = true and a head built with pageHead. The sitemap lists the page on its own; see SEO.

  3. Put the copy in messages/<locale>/marketing.json (e.g. about.*) and read it with useTranslations('marketing.about').

  4. Link to it from config/marketing-navigation.config.ts if it belongs in the header or footer.

pnpm test:e2e then checks the new page like the others: no Set-Cookie, no private, the same HTML for every host, no per-visitor data, a hydrated layout, no console errors, and exactly one h1 (a page without one, or with two, fails). Pages with [params] in their path aren't visited by these checks; test them yourself.

Visitors without cookies get marketing pages with no CSP. Void's client-side navigation keeps that document, so a link from a marketing page into an app or sign-in page must load the page fully, or that page runs without its CSP:

<LocalizedLink href="/auth/sign-up" reloadDocument>…</LocalizedLink>

Header and footer links do this already. Links between marketing pages may navigate client-side.

What Doesn't Belong Here

A page that reads query parameters or headers, takes user input (contact form, search, comments) or shows user data must live outside (marketing)/, e.g. pages/contact.tsx. Here it would be cached for everyone and run without a CSP. There is no per-page opt-out on purpose: the folder is the rule.


Next: Caching →