Overview / 02
Configuration
Zole loads zole.config.ts (or .mjs / .js, with fallback to contenz.config.* and content.config.*) using defineConfig from @zolekit/core.
Discovery modes
You can use filesystem discovery, centralized collection declarations, or both together:
- Filesystem discovery (
sources): scans directories matchingsources(default["content/*"]) forschema.tsmodules. - Centralized (
collections/singles): declares schemas, relations, computed fields, and path patterns inline insidezole.config.ts.
import { defineConfig, defineSingle, presets } from "@zolekit/core";
import { z } from "zod";
const siteSingle = defineSingle({
schema: presets.page().extend({
siteName: z.string(),
tagline: z.string(),
}),
});
export default defineConfig({
sources: ["content/*"],
singles: {
site: {
path: "content/site.json",
schema: siteSingle.meta,
},
},
outputDir: "generated/content",
coveragePath: "zole.coverage.md",
extensions: ["md", "mdx", "json"],
ignore: ["README.md", "_*"],
strict: false,
search: {
enabled: true,
},
});
Top-level options
| Option | Default | Purpose |
|---|---|---|
sources |
["content/*"] |
Directory globs scanned for collection schema.ts files |
collections |
undefined |
Inline collection map keyed by collection name |
singles |
undefined |
Key-addressed single content files without a slug axis |
outputDir |
"generated/content" |
Destination directory for generated TypeScript and .d.ts files |
coveragePath |
"zole.coverage.md" |
Output file for translation and lint coverage reports |
extensions |
["md", "mdx", "json"] |
Allowed content file extensions across collections |
ignore |
["README.md", "_*"] |
Glob patterns skipped during discovery |
strict |
false |
Escalate warnings such as missing translations into failing errors |
search |
false |
Enable Orama index emission to .zole/search-index.json |
i18n |
false |
Enable locale filename parsing, fallback chains, and staleness tracking |
hooks |
undefined |
Lifecycle callbacks (beforeBuild, transformItem, afterBuild) |
Built-in presets
@zolekit/core exports composable Zod 4 factory helpers via presets:
presets.blogPost():title,date, optionalexcerpt,tags, anddraftdefaultfalse.presets.docsPage():title, optionaldescription, and integerorder.presets.page(): minimaltitleschema for single or landing pages.
Multi-language configuration
Enable i18n with locale lists, directional fallback chains, and output layout:
export default defineConfig({
i18n: {
enabled: true,
defaultLocale: "en",
locales: ["en", "zh-CN", "zh-TW"],
fallback: {
"zh-TW": ["zh-CN", "en"],
"zh-CN": "en",
},
coverageThreshold: 0.8,
detectStale: true,
outputStrategy: "merged",
},
});
Setting outputStrategy: "split" emits per-locale chunk modules and resolver helpers alongside root type declarations so large localized sites can code-split by locale.