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:

javascript
// 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 },
};
Note

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.

OptionTypeDefaultDescription
srcDirstring"src"Directory scanned for pages, layouts, and partials. Files prefixed with _ are treated as templates and never emitted.
outDirstring"dist"Build output directory. Emptied before each production build unless --no-clean is passed.
staticDirstring"static"Copied to outDir verbatim, no processing. Set to false to disable.
basestring"/"Public base path, e.g. "/docs/" when serving from a sub-path. All generated links are prefixed with it.
trailingSlashbooleantrueEmit /about/index.html (true) or /about.html (false). Affects generated links too.
layoutstring"_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.

OptionTypeDefaultDescription
markdown.smartQuotesbooleantrueConvert straight quotes and dashes to typographic equivalents ("“ ”, --). Code spans are never touched.
markdown.anchorsstring | false"h2-h4"Range of headings that get slugified id attributes and anchor links. Set false to disable.
markdown.footnotesbooleantrueEnable 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.highlightbooleantrueSyntax-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.

OptionTypeDefaultDescription
i18n.defaultLocalestring"en"Locale served at the site root without a path prefix.
i18n.localesstring[]["en"]BCP 47 tags, e.g. ["en", "fil", "de-AT"]. Each non-default locale is served under /<locale>/.
i18n.translationsDirstring"i18n"Folder of per-locale JSON dictionaries available in templates as {{ t("key") }}.
i18n.fallbackbooleantrueIf a page has no translation for a locale, reuse the default-locale content instead of 404ing.

Dev & build options

OptionTypeDefaultDescription
dev.portnumber8484Dev server port. If taken, Baybay increments until it finds a free one and tells you.
dev.hoststring"localhost"Set to "0.0.0.0" to expose the server on your LAN (also printed as the Network URL).
dev.openbooleanfalseOpen the browser automatically when the server starts.
build.minifybooleantrueMinify emitted HTML and CSS. Your own JS files are copied untouched.
build.sitemapbooleantrueWrite sitemap.xml at the output root. Requires site.url to be set for absolute URLs.
build.cleanUrlsbooleantrueStrip .html from generated internal links (pairs with trailingSlash).
build.draftsbooleanfalseInclude 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:

VariableEquivalentExample
BAYBAY_OUT_DIRoutDirBAYBAY_OUT_DIR=public baybay build
BAYBAY_BASEbaseBAYBAY_BASE=/docs/ baybay build
BAYBAY_PORTdev.portBAYBAY_PORT=3000 baybay dev
BAYBAY_TOKENdeploy credentialRead by baybay deploy; never stored on disk.
Precedence

CLI flags > environment variables > baybay.config.js > built-in defaults. The effective config is printed with baybay build --verbose.