# Markdown, YAML, TOML & JSON

## Markdown, YAML, TOML & JSON

**Skill level:** Complete beginner · **Time:** 10 minutes

Covena uses four text formats. They look different, but the rules are short, and almost every error comes from the same few mistakes.

### Content Files: Frontmatter + Markdown
A content file has two parts. The **frontmatter** at the top, between two `---` lines, holds settings in YAML. The **body** below it is Markdown text.

```md
---
title: "Buying a home: the searches that matter"
description: "What each search tells you and what to do with the results."
image: "/images/covena/blog/blog-house-keys.jpg"
date: 2026-10-07
author: "James Whitfield"
categories:
  - "Property"
draft: false
---

This is the body. It is written in **Markdown**.

## A heading
```

Section files and most page files are frontmatter only: everything is a setting, and there is no body. Practice areas, results, legal pages, and insights posts have a body too.

### YAML (Frontmatter)
```yaml
title: "Fixed fees for common work"   # text: use quotes
enable: true                          # yes or no: true or false, no quotes
weight: 2                             # number: no quotes
button:                               # a group: the next lines are indented
  label: "See all fees"
  url: "/fees/"
relatedAttorneys:                     # a list: each item starts with "- "
  - "henry-lawson"
  - "daniel-mercer"
```

**The rules**

- **Indent with 2 spaces.** Never tabs. Items inside a group are indented 2 spaces more than the group's name.
- **Put text in quotes**, especially when it contains `:`, `#`, `'`, or starts with a special character.
- **A `#` starts a comment.** Everything after it on the line is ignored. Covena's comments explain the options and list the other layouts, so leave them.
- **Keys are case-sensitive.** `metaTitle` works, `metatitle` doesn't, and a misspelled key is usually ignored without an error.
- **Prices with a comma go in quotes.** In the fees section, `price: "1,250"` keeps the thousands separator. A plain number like `450` needs no quotes.
- **One word in `<em>`** in a title is set in the accent serif: `title: "Clear legal advice for families and <em>businesses</em>"`.

### TOML (`config.toml`)
```toml
[settings]                          # a table: the lines below belong to it
  stickyHeader = true               # true or false
  pagination   = 6                  # a number

  [settings.contactInfo]            # a table inside [settings]
    phone = "[+44 20 7946 0321](tel:+442079460321)"   # text in quotes
    email = "[hello@example.com](mailto:hello@example.com)"

[seo]
  keywords = ["law firm", "attorney"]   # a list in square brackets

[head]
  content = """
  <script></script>
  """                               # multi-line text between triple quotes
```

**The rules:** `key = value`, text in quotes, one key per line, and a key belongs to the `[table]` above it. Indentation doesn't matter in TOML, but keep it tidy. A key under the wrong table is ignored, so check which `[table]` line is above the key you edit.

### JSON (Menus, Fonts, Languages, Social, Translations)
```json
{
  "enable": true,
  "name": "Fees",
  "weight": 5,
  "url": "/fees/"
}
```

**The rules**

- Keys and text values use **double quotes**.
- Items are separated by **commas**, and the **last item has no comma**.
- Every `{` has a matching `}` and every `[` a matching `]`.
- No comments allowed. (The `"_comment"` keys in `src/i18n/<lang>.json` are ordinary values used as notes.)
- Every file in `src/i18n/` must have the same keys. If you add a key to `en.json`, add it to `fr.json` and `ar.json` too.

<Aside type="tip">
  Most JSON errors are a missing or extra comma. VS Code underlines the
  problem in red. Hover over it to see the message.
</Aside>

### Reading An Error Message
When a file has a mistake, the terminal running `npm run dev` (and the browser) shows an error. Look for three things:

1. **The file path**, for example `src/content/attorneys/english/henry-lawson.md`.
2. **The line number**, or the name of the field.
3. **What was expected**, for example "Expected boolean, received string" (you wrote `"true"` instead of `true`).

Fix that line and save. If the message is unclear, copy the whole error into your AI assistant and ask it to explain and fix it.

A broken format (bad indentation, a missing quote or comma) shows an error in any file. A wrong value, such as `"true"` instead of `true`, is reported in collections that have a schema, page blocks included. Section files in `src/content/sections/` only have their shared fields checked, so a misspelled option there shows only on the page. Look at the page after editing them.

Some mistakes print a yellow warning instead of an error, and the site still builds:

- `[site]` at the end of `npm run build`: the site URL (`[site] baseUrl`) is not set yet.
- `[attorneys] No entry named "..."` (or `[results]`, `[practice-areas]`, and so on): a list in a content file names a slug that has no file. Fix the spelling, or add the entry.

`[toml-watcher] ✖ Conversion failed` is printed in red: `config.toml` has a format mistake. The site keeps the last good settings until you fix it and save again.