Configuration
Baybay runs with no config file at all. When you need to change a default, create baybay.config.js at the project root — every option on this page is optional.
The config file
Export a plain object. Baybay validates it on startup and fails fast with the exact key that is wrong:
// baybay.config.js
export default {
srcDir: "src",
outDir: "dist",
base: "/",
trailingSlash: true,
markdown: {
smartQuotes: true,
anchors: "h2-h4",
footnotes: true,
},
i18n: {
defaultLocale: "en",
locales: ["en", "fil", "de"],
},
dev: { port: 8484, open: false },
build: { minify: true, sitemap: true, cleanUrls: true },
};
Both ESM (export default) and CommonJS (module.exports) are accepted. TypeScript configs (baybay.config.ts) work if typescript is installed locally.
Core options
Paths are resolved relative to the config file.
| Option | Type | Default | Description |
|---|---|---|---|
srcDir | string | "src" | Directory scanned for pages, layouts, and partials. Files prefixed with _ are treated as templates and never emitted. |
outDir | string | "dist" | Build output directory. Emptied before each production build unless --no-clean is passed. |
staticDir | string | "static" | Copied to outDir verbatim, no processing. Set to false to disable. |
base | string | "/" | Public base path, e.g. "/docs/" when serving from a sub-path. All generated links are prefixed with it. |
trailingSlash | boolean | true | Emit /about/index.html (true) or /about.html (false). Affects generated links too. |
layout | string | "_layout.html" | Default layout applied to every page. Override per page with the layout front-matter key. |
Markdown options
All keys live under the markdown object.
| Option | Type | Default | Description |
|---|---|---|---|
markdown.smartQuotes | boolean | true | Convert straight quotes and dashes to typographic equivalents (" → “ ”, -- → –). Code spans are never touched. |
markdown.anchors | string | false | "h2-h4" | Range of headings that get slugified id attributes and anchor links. Set false to disable. |
markdown.footnotes | boolean | true | Enable GitHub-style footnote syntax ([^1]). |
markdown.externalLinks | "new-tab" | "same-tab" | "same-tab" | When "new-tab", external links get target="_blank" rel="noopener" automatically. |
markdown.highlight | boolean | true | Syntax-highlight fenced code blocks at build time. Zero client-side JS is shipped for this. |
i18n options
Declaring more than one locale makes Baybay mirror your route tree per locale: src/about.md becomes /about/ and /fil/about/, with hreflang alternates injected into each page head.
| Option | Type | Default | Description |
|---|---|---|---|
i18n.defaultLocale | string | "en" | Locale served at the site root without a path prefix. |
i18n.locales | string[] | ["en"] | BCP 47 tags, e.g. ["en", "fil", "de-AT"]. Each non-default locale is served under /<locale>/. |
i18n.translationsDir | string | "i18n" | Folder of per-locale JSON dictionaries available in templates as {{ t("key") }}. |
i18n.fallback | boolean | true | If a page has no translation for a locale, reuse the default-locale content instead of 404ing. |
Dev & build options
| Option | Type | Default | Description |
|---|---|---|---|
dev.port | number | 8484 | Dev server port. If taken, Baybay increments until it finds a free one and tells you. |
dev.host | string | "localhost" | Set to "0.0.0.0" to expose the server on your LAN (also printed as the Network URL). |
dev.open | boolean | false | Open the browser automatically when the server starts. |
build.minify | boolean | true | Minify emitted HTML and CSS. Your own JS files are copied untouched. |
build.sitemap | boolean | true | Write sitemap.xml at the output root. Requires site.url to be set for absolute URLs. |
build.cleanUrls | boolean | true | Strip .html from generated internal links (pairs with trailingSlash). |
build.drafts | boolean | false | Include pages marked draft: true in front matter. The dev server always includes drafts. |
Environment variables
A few settings can be supplied via the environment, which always wins over the config file. Useful in CI:
| Variable | Equivalent | Example |
|---|---|---|
BAYBAY_OUT_DIR | outDir | BAYBAY_OUT_DIR=public baybay build |
BAYBAY_BASE | base | BAYBAY_BASE=/docs/ baybay build |
BAYBAY_PORT | dev.port | BAYBAY_PORT=3000 baybay dev |
BAYBAY_TOKEN | deploy credential | Read by baybay deploy; never stored on disk. |
CLI flags > environment variables > baybay.config.js > built-in defaults. The effective config is printed with baybay build --verbose.