Skip to content

Frontmatter

Frontmatter is the YAML configuration you place between --- fences. astro-slides has two kinds, and the difference is purely where the block appears in the file:

  • Headmatter — the first frontmatter block in the deck. Holds deck-wide config.
  • Per-slide frontmatter — a frontmatter block after any later --- separator. Overrides inherited config for that one slide.

All frontmatter objects are loose: unknown keys (layout-specific fields, or Marp/ Slidev fields astro-slides doesn’t model) pass through instead of being stripped. The authoritative field list is the Zod schema in packages/types/src/frontmatter.ts.

The first block, configuring the whole deck:

---
title: Cosmic Theme Showcase
theme: cosmic
duration: 15min
---
# Cosmic
The flagship theme for astro-slides.
FieldTypeDefaultPurpose
titlestring""Deck title for <title>, exports, MCP responses.
themestring"starter"Bundled theme to apply (see below).
classstring""Default CSS class applied to every slide.
aspectRatiostring"16:9"Slide aspect ratio (e.g. "16:9", "4:3", "1:1").
canvasWidthnumber1920Pixel width of the slide canvas.
colorSchema"auto" | "light" | "dark" | "all""auto"Force a color scheme. "all" ships both.
transitionstring | object"fade"Default slide-to-slide transition.
fontsobjectFont stack overrides (sans/serif/mono/weights/…).
seoMetaobjectOpen Graph + Twitter card metadata.
drawingsobject{ persist: false }Drawing-layer options (persist/presenterOnly/syncAll).
record"dev" | "prod" | falsefalseEnable the recording UI.
presenterbooleantrueWhether the presenter view is reachable.
routerMode"history" | "hash""history"URL routing strategy.
durationstringTalk duration (e.g. "20min"); drives the presenter timer.
addonsstring[][]Addon names or paths to load.
mdcbooleanfalseEnable MDC directive syntax in MDX.
monaco"dev" | "prod" | falsefalseEnable Monaco code blocks (opt-in).
marpbooleanSelect the Marp-flavor parsing path.

Note that colorSchema is the field name (the color-scheme control), spelled with the Schema suffix.

theme: names a bundled theme the deck opts into. starter is the default; set another name to switch:

---
title: My Talk
theme: cosmic
---

The deck and print routes stamp data-theme="cosmic" and the theme’s tokens apply. See the theme docs for the full list of bundled themes.

A block after a later --- separator, scoped to the slide that follows it:

---
## Default layout
- point one
- point two
---
layout: two-cols
---
Left column content.
::right::
Right column content.
FieldTypeDefaultPurpose
layoutstringLayout to wrap this slide’s body (see below).
classstringCSS class applied to this slide.
transitionstring | objectinheritedPer-slide transition override.
clicksnumbercomputedOverride the computed total click count.
clicksStartnumber0Starting click index for relative +K resolution.
levelnumberSection nesting level (for the table of contents).
hidebooleanfalseSkip this slide in render and export.
hideInTocbooleanfalseKeep the slide but omit it from <Toc> lists.
srcstringImport another Markdown/MDX file as this slide’s source.
routeAliasstringURL fragment override for this slide.
zoomnumber1Zoom multiplier for the slide content.
preloadbooleanfalseForce eager-load of iframes/media.
exportAs"editable" | "image""editable"PPTX export fidelity for this slide.
backgroundstringSlide background (color or image).
dragPosobjectPersisted positions for <VDrag> elements, by id.
clickAnimationstringinheritedDefault animation class for this slide’s click steps.

layout: picks the layout that wraps a slide’s body. astro-slides ships a set of built-in layouts — center, section, two-cols, statement, fact, quote, end, and more:

---
layout: center
---
## Centered
Content centered on both axes.

Layouts can accept extra fields beyond the table above; because frontmatter is loose, those pass straight through to the layout as props. For example, two-cols accepts leftClass / rightClass:

---
layout: two-cols
leftClass: pr-4
rightClass: pl-4
---
  • packages/types/src/frontmatter.ts — the authoritative Zod HeadmatterSchema and FrontmatterSchema (field names, types, defaults).
  • docs/architecture/frontmatter.md — the full frontmatter reference and compat notes.
  • docs/built/02-parser.md — how the first block is run through both schemas.
  • examples/minimal/slides.md, examples/minimal/content/decks/cosmic/slides.mdx — real headmatter and per-slide frontmatter.