PAGES_SITE

tcmts.cli.test.e2e.prod.PAGES_SITE · #uyrm2yxm · term · runs anywhere

A site of a few pages, each a server component's: what testStaticSitesRenderEveryPage builds.

export const PAGES_SITE = `// tcm: namespace site
import { useAppLinks, useLocation } from "#codebase/site/lib/react";

export const TITLES: Record<string, string> = { "/": "Home", "/about": "About us", "/blog/first": "First post" };

export async function Page({ path }: { path: string }) {
  const title = TITLES[path] ?? "Not here";
  return (
    <main>
      <h1>{title}</h1>
      <nav>
        <a href="/">home</a> <a href="/about">about</a> <a href="/blog/first">first</a>
        <a href="/notes.pdf">a file</a> <a href="https://example.com/x">elsewhere</a>
      </nav>
    </main>
  );
}

export function App() {
  useAppLinks();
  return <Page path={useLocation().path} />;
}
`

used by