Configuration
aces.config.ts holds the site, locales, features and the registries for components, page bodies and page types.
Each project has one config file, aces.config.ts. The app reads it at build and run time. The aces CLI reads it for setup, Live Preview URLs and code generation. Brand tokens live in src/app/styles.css, and secrets live in .env.local.
import { defineAcesConfig } from "@aces-core/core/config";
export default defineAcesConfig({
site: { name: "Northwind", appId: "northwind", url: "https://www.northwind.com" },
i18n: { defaultLocale: "en-US", locales: [{ locale: "en-US", label: "English", short: "EN" }] },
seo: { /* default social image */ },
features: { articles: { enabled: true }, search: true, optimization: false },
ui: { skin: "none", stickyHeader: false, paginationParam: "page" },
components: { /* … */ },
pageBodies: { /* … */ },
pageTypes: { /* … */ },
});
Sections
| Section | What it controls |
|---|---|
site |
Name, App ID (appId) and the public URL (url, optional) |
i18n |
Locales and the default. Each locale must exist in the Contentful space. |
seo |
The default social image |
features |
articles (on or off, filters, sort, page size, order, tags, social share), search, optimization |
ui |
skin ("none" Unstyled or "base": change it with aces skin, not by hand), sticky header, pagination query parameter |
components |
The cf component library, keyed by GraphQL __typename |
pageBodies |
Named lists of components that a page type’s body allows |
pageTypes |
Routable content types: route, optional listing, body, Live Preview path |
contentful.previews |
Extra Live Preview URLs by content type (for example apps) |
The schema is checked on import, so a bad reference stops dev and build with a clear message. Examples are an unknown component in a page body, or a page type pointing at a body that doesn’t exist.
Components
components: {
StatStrip: {
title: "Stat Strip", // label in selectors
description: "Row of numbers",
contentType: "statStrip", // Contentful content type id
dir: "cf-stat-strip", // src/libs/cf/lib/<dir>
name: "StatStrip", // optional export stem if it differs from the key
owns: ["stat"], // optional child content types removed with it
requires: ["Image"], // optional components it renders
core: false, // true = always installed
nested: false, // true = rendered inside other components, never in a page body
optimization: false, // set by `aces component add-optimization`
},
}
Page bodies
A page body is a named list of components. A page type’s body field allows exactly the components in its page body. Several page types can share one body.
pageBodies: {
default: { title: "Page Body", components: ["Hero", "RichTextSection", "Lockup", "Banner", "Grid"] },
caseStudy: { title: "Case Study", components: ["Hero", "RichTextSection", "StatStrip"] },
}
Page types
pageTypes: {
caseStudy: {
title: "Case Study",
contentType: "caseStudy",
route: "/case-studies/[slug]", // under src/app/[lang]
listing: "/case-studies", // optional
specialtyPage: "Case Studies Listing", // optional; needs a listing
body: "caseStudy", // a pageBodies key, or "richText"
bodyField: "pageBody", // optional; default pageBody or body
preview: "/api/draft/…", // optional Live Preview path
},
}
Specialty Pages
A Page entry’s Specialty Page field marks one of two things:
- the home page (
Homepage) - the Page that holds a listing’s title and SEO:
Articles Listing, plus one for each page type listing (for exampleCase Studies Listing)
The field’s options come from the config. aces sync writes them to contentful/models.json, and aces sync --contentful writes them to the space. A Page with a Specialty Page redirects to that path, and links to it resolve there.
After you edit it
pnpm aces sync # check config against code, regenerate the registry
pnpm aces sync --check # change nothing; fail if anything is out of date (CI)
pnpm aces sync --contentful # also push page body rules, link targets and Live Preview URLs
Common changes
Add a language. Add the locale in Contentful, add it to i18n.locales, and add UI strings in src/libs/i18n/locale/<code>/.
Rebrand. Edit the tokens in src/styles/tokens.css and the fonts in src/libs/theme/lib/fonts.ts, then the skin. See Rebrand and restyle.
Deploy. Set site.url, then run pnpm aces previews so Live Preview points at the deployed site. Metadata and share links also use site.url when it’s set. Otherwise they use the request host.
Something wrong or missing? Open an issue.