Concrete
Reference

template.ts

Looking up what the one reserved file declares — identity, format, pages, canvases, preview, fixtures.

defineTemplate

Signature

import { defineTemplate, type PageComponent, website } from "@homepages/concrete";
import icon from "./icon.svg";

declare const Home: PageComponent;

export default defineTemplate({
  key: "meridian",
  name: "Meridian",
  format: website,
  icon,
  scope: "global",
  pages: {
    home: { label: "Home", path: "/", page: Home },
  },
  fixtures: "./fixtures/index.json",
});

Parameters

key is the template's platform identity, namespaced <template>/<key> at publish. name is the display name the picker, the editor and the dashboard show on one line — two words at most.

format declares the artifact class and nothing else does: one format value, or a non-empty list of formats of one class. icon is an imported asset (import icon from "./icon.svg"), so its value is the built URL rather than a path you write.

scope is the audience: "global", { org } for one org, or { orgs } for several.

pages is the site map. The object key is the page id, the object order is artifact order, and each entry carries a label (the name in the editor's page bar, the sidebar and a nav menu), a page component, an optional optional, and — on a website only — a path, or — on a rendered class only — an optional direction: "column" (the default) or "row".

canvases overrides the editing surfaces: the object key is the canvas id, the object order is canvas-bar order, and each entry names a label and the pages it presents, by their pages key. Omitted, the class default is stamped explicitly — one canvas per page on a website, one canvas holding every page on a rendered class.

preview is the picker card: blurb, intents, types, and an optional demoUrl.

fixtures names the fixture list, a path relative to template.ts: the content fixtures concrete dev offers and concrete check grades with, each a document naming the property it is on (fixtures). It is dev data: it enters no bundle and no content hash, so changing a fixture re-versions nothing.

Constraints

Always the default export of template.ts, and always a defineTemplate value — the workspace loads by reading that export. template.ts is the only file the framework finds by name: pages, sections, the stylesheet and the icon are reached from it by import, and the fixtures by the list fixtures names. Without that list there is no fixture, and concrete check reports fixtures/none.

Always one artifact class: a format list that mixes classes throws, and a design spanning classes is two templates sharing sections. An empty format list throws.

Never a path on a rendered class's page, and never a page without one on a website. The type discriminates on format's class, so both are compile errors rather than publish-time failures.

Never an empty pages, and never a canvas naming a page the site map does not declare — both throw at declaration.

Never a scope that names no org, names one twice, or names one that is not a UUID. The org set is the audience and never the identity: adding or reordering orgs can neither mint a second template nor orphan the existing one.

Never cross-section logic. A slot that depends on another section declares the read on its own source: — a slot ref or compute({ reads }) — in its section's module; the template composes the sections and says nothing about how they relate.

Never a side effect at module scope that a page render needs. Importing template.ts evaluates no page — the page components are rendered once, later, under the placement probe.

Example

import {
  defineTemplate,
  fact,
  fill,
  Section,
  section,
  Slot,
  text,
  website,
} from "@homepages/concrete";
import icon from "./icon.svg";

export const Hero = section(
  {
    key: "hero",
    label: "Hero",
    slots: {
      headline: text.medium({
        label: "Headline",
        cap: 60,
        source: fill.write({ reads: [fact.property.description], brief: "What makes the property worth seeing. Write one sentence. Confident and specific." }),
      }),
    },
  },
  ({ slot }) => (
    <Section>
      <Slot.Text slot={slot.headline} as="h1" />
    </Section>
  ),
);

const Home = () => <Hero />;
const Gallery = () => <Hero instance="hero-gallery" />;

export default defineTemplate({
  key: "meridian",
  name: "Meridian",
  format: website,
  icon,
  scope: { org: "3f8c1d2e-4a5b-4c6d-8e9f-0a1b2c3d4e5f" },
  pages: {
    home: { label: "Home", path: "/", page: Home },
    gallery: { label: "Gallery", path: "/gallery", page: Gallery, optional: true },
  },
  preview: {
    blurb: "A quiet, photograph-led listing site.",
    intents: ["for_sale"],
    types: ["single_family", "condo_townhome"],
  },
  fixtures: "./fixtures/index.json",
});

Rules that apply

workspace/template-invalid, pages/composition-invalid, fixtures/none.

See also

section for the value a page places, slot builders for what a section exposes, Pages and composition for why a page is read by a probe rather than rendered, and Reading another section for how one section's slot follows another's — declared on the slot, never on the template.