Configuration

Learn how to configure the documentation site made with UnDocs.

#Example

# <!-- TODO: automd file generator should support code block wrapper! PR welcome ;) -->
<!-- automd:file src="../../template/.config/docs.yaml" -->

# yaml-language-server: $schema=https://unpkg.com/undocs/schema/config.json

name: "packageName"
shortDescription: ""
description: ""
github: "unjs/packageName"
# url: 'https://packageName.unjs.io'
# llms:
#   # Generate `/llms.txt` and `/llms-full.txt`
#   domain: 'https://packageName.unjs.io'
#   title: 'packageName'
#   description: ''
#   full:
#     title: 'packageName'
#     description: ''
# redirects:
#   "/from": "/to"
# automd: true
landing:
  heroLinks:
    stackblitz:
      icon: "i-lucide-play"
      to: "https://stackblitz.com/github/unjs/packageName/tree/main/playground"
  # contributors: true
  # features:
  #   - title:
  #     description:

<!-- /automd -->

#Cross-origin isolation

Pages that use SharedArrayBuffer or wasm threads — an embedded SQLite build, an FFmpeg demo, a Rust playground, anything reaching for Atomics.wait — only get those APIs on a cross-origin isolated page. Isolation is opt-in, and off by default:

crossOriginIsolation: true

With it on, every response serves:

Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: credentialless

Both headers are required — COOP alone does not isolate. They are applied through Nitro route rules, so undocs dev and the built output behave identically.

credentialless (what true means) sends cross-origin no-cors subresource requests without credentials, so third-party images, fonts and scripts keep loading whether or not the servers hosting them opt in.

require-corp is the stricter alternative, and only safe once every cross-origin asset the docs load sends Cross-Origin-Resource-Policy (or is fetched with CORS) — anything that does not is blocked outright:

crossOriginIsolation: require-corp

Note

Under either value, a cross-origin iframe must send its own Cross-Origin-Embedder-Policy to load at all. Check any embedded playground, video or third-party widget after turning isolation on — that is a property of isolation itself, not of the value you pick.

#Package tarball

Set pkg to include an installable package tarball with your built site:

pkg: true

true selects the package one level above the docs directory. You can also set a path relative to the docs directory:

pkg: "../packages/core"

During a production build, undocs runs the package's build script if it has one. It uses the package manager detected by nypm. It then runs npm pack and serves the tarball at /latest.tgz. The latest flag of the pm-i automd generator writes the install command for it, using the canonical url from your docs config:

This URL stays the same for every deployment. undocs dev does not build or pack the package.

#Reference

#$schema

  • Type: string

#automd

  • Type: boolean

Enable integration with https://automd.unjs.io

Banner configuration

#actions

  • Type: array

Display a list of action buttons next to the title.

#close

  • Type: undefined

#closeIcon

  • Type: string
  • Default: "i-lucide-x"

The icon displayed in the close button (e.g., 'i-lucide-x').

#color

  • Type: string
  • Default: "primary"

Banner color theme.

#icon

  • Type: string

The icon displayed next to the title (e.g., 'i-lucide-info').

#id

  • Type: string

A unique id saved to local storage to remember if the banner has been dismissed. Change this value to show the banner again.

#target

  • Type: string

Link target attribute.

#title

  • Type: string

The banner title text.

#to

  • Type: string

Link destination URL or route path.

#ui

UI customization classes for banner components.

#actions
  • Type: undefined

Actions container classes

#center
  • Type: undefined

Center section classes

#close
  • Type: undefined

Close button classes

#container
  • Type: undefined

Container element classes

#icon
  • Type: undefined

Icon element classes

#left
  • Type: undefined

Left section classes

  • Type: undefined

Right section classes

#root
  • Type: undefined

Root element classes

#title
  • Type: undefined

Title element classes

#branch

  • Type: string

The branch of the GitHub repository for the documentation site.

#buildCache

  • Type: boolean

Enable build cache (experimental)

#description

  • Type: string

The description of the documentation site.

#dir

  • Type: string

Documentation directory

Note: This option will be automatically set

Footer configuration

#notes

  • Type: string | string[]

One or more lines of Markdown shown in the footer in place of the site name and short description, for a license, a hosting credit or similar. Each entry is rendered at build time and becomes one line.

footer:
  notes:
    - "Released under the [MIT License](https://github.com/unjs/undocs/blob/main/LICENSE)."
    - "Hosted on [Example](https://www.example.com)."

#github

  • Type: string

The GitHub repository for the documentation site.

#landing

  • Type: undefined

#lang

  • Type: string
  • Default: "en"

The language of the documentation site.

#llms

Configuration for llms.txt generation (/llms.txt and /llms-full.txt).

#description

  • Type: string

Description used in /llms.txt.

#domain

  • Type: string

Public site domain (e.g. https://example.com).

#full

Metadata for /llms-full.txt.

#description
  • Type: string

Description used in /llms-full.txt.

#title
  • Type: string

Title used in /llms-full.txt.

#title

  • Type: string

Title used in /llms.txt.

#name

  • Type: string

The name of the documentation site.

#redirects

Redirects for the documentation site.

#shortDescription

  • Type: string

The description of the documentation site.

#socials

Social media links for the documentation site.

#sponsors

#api

  • Type: string

The URL to the sponsors JSON API.

#themeColor

  • Type: string

The accent color of the documentation site. Defaults to mono.

Accepts mono (no accent — links and active navigation read in body color, the monochrome default), a Geist hue (blue, red, amber, green, teal, purple, pink), a Tailwind palette name that maps onto the nearest Geist hue (violet -> purple, cyan -> teal, rose -> red, ...), a neutral name (gray, slate, zinc, neutral, stone) as a synonym for mono, or any CSS color.

It tints links, active navigation, icons, and the landing glow, and is used for the theme-color meta tag. Buttons and other solid fills stay monochrome, as they are in Geist.

#url

  • Type: string

The URL of the documentation site.

#versions

  • Type: array

The versions of the documentation site.