[Hatchet Labs](https://hatchetlabs.com/index.md) · [projects](https://hatchetlabs.com/projects/index.md) · [notes](https://hatchetlabs.com/notes/index.md) · [about](https://hatchetlabs.com/about/index.md)

# Backmatter

It's Frontmatter but at the back of the file.

Backmatter is Frontmatter at the back of the file. Frontmatter is a YAML block between lines of three hyphens at the start of a document. Backmatter is the same block at the end. A parser reads both blocks and combines their root keys. When keys collide, Frontmatter wins.

The point is order. Some metadata is only known once the writing is done, some metadata is longer than the plain text body!, and some metadata is a spoiler the text that is about to come. Backmatter allows you to put the body first.

```markdown
The writing comes first.

---
title: "When Backmatter matters"  
tags: ["Backmatter", "Frontmatter"]  

---
```

A renderer that only knows how to parse Frontmatter shows the block as plain Markdown, so the file is readable with or without explicit Backmatter support.

## Use it

The reference parser is on npm: [`@hatchetlabs/backmatter`](https://www.npmjs.com/package/@hatchetlabs/backmatter). The js reads each block with gray-matter and combines the root keys.

```js
const backmatter = require('@hatchetlabs/backmatter');

backmatter('The writing comes first.\n\n---\ntitle: any metadata\n---\n');
// { data: { title: 'any metadata' }, content: 'The writing comes first.\n\n', backmatter: true }
```

The repository holds the spec, the parsers, working examples and a skill, under the MIT license.

---
date: 2026-11-11  
kind: spec  
tags: ["markdown","metadata"]  
link: https://github.com/hatchetlabs/backmatter  
download: https://www.npmjs.com/package/@hatchetlabs/backmatter  
html: https://hatchetlabs.com/projects/backmatter/  

---
