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:

  1. Filesystem discovery (sources): scans directories matching sources (default ["content/*"]) for schema.ts modules.
  2. Centralized (collections / singles): declares schemas, relations, computed fields, and path patterns inline inside zole.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, optional excerpt, tags, and draft default false.
  • presets.docsPage(): title, optional description, and integer order.
  • presets.page(): minimal title schema 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.

Type a command, config option, or guide title.