TOML Frontmatter

Hugo and Zola write frontmatter as TOML between +++ lines. Accent reads this form in accent build, accent serve, and accent validate, so a site builds before you change a file. This page uses TOML frontmatter itself.

+++
# The page title
title = "Release notes"
date = 2026-11-21
tags = ["news"]

[extra]
author = "Ann" # shown in the byline
+++

Accent writes only YAML. The conversion keeps each TOML comment as a YAML comment, at the same position:

---
# The page title
title: Release notes
date: 2026-11-21
tags: [news]

extra:
  author: Ann  # shown in the byline
---

Convert all pages

accent build and accent serve log one note with the number of TOML pages. accent validate lists each TOML file as a notice. Neither command writes a content file.

To convert the pages, run accent migrate frontmatter:

# Show each change. Nothing is written.
accent migrate frontmatter

# Convert every TOML page in the content directory
accent migrate frontmatter --write

# Convert one directory
accent migrate frontmatter content/blog --write

Convert on the first edit

The first edit that changes the frontmatter of a TOML page converts the block to YAML, then applies the edit, in one write. This applies to the admin editor, the MCP update_frontmatter tool, and accent content update-frontmatter. The result reports converted_from: "toml", and the audit commit says that the block changed.

An edit of the body only keeps the TOML block byte for byte.

A site that must stay TOML

During a migration, another generator can still build the site. Set content.toml_frontmatter to read_only to refuse a frontmatter edit of a TOML page:

content:
  toml_frontmatter: read_only   # default: convert_on_edit

Accent still reads the TOML pages, and accent migrate frontmatter --write still converts them, because you run it on purpose.

The safety gate

Before a conversion writes, Accent parses the YAML text and makes two checks:

  1. The YAML text must hold the same values as the TOML block.
  2. Each TOML comment must appear in the YAML text.

If a check fails, the conversion stops, the error names the key or the comment, and the file does not change.

Value mapping

TOMLYAML
A stringA plain scalar, or a quoted one when a plain scalar would change its type ("yes", "1.0")
A multi-line stringA literal block scalar (|, |-, or |+)
A hex, octal, or binary integerThe decimal value, with the original as a comment (255 # 0xFF)
inf, -inf, nan.inf, -.inf, .nan
A date or a datetimeThe same text, unquoted
A local timeA quoted string
A table, a dotted key, an inline tableA nested block mapping
An array of tables ([[x]])A sequence of mappings

Blank lines before the opening +++ are allowed, as Zola allows them. The conversion removes them.