Content
Content authoring patterns and frontmatter conventions.
On this page
Frontmatter Schema
Every content file starts with YAML frontmatter:
---
layout: layouts/page.njk # Required
title: Page Title # Required
description: Meta desc # Recommended
date: 2026-01-08 # Recommended
draft: false # Optional
tags: [tag1, tag2] # Optional
image: /path/to/og.jpg # Optional
---
Layout Options
| Layout | Use Case |
|---|---|
layouts/base.njk |
Raw HTML shell, rarely used directly |
layouts/page.njk |
Standard content pages |
layouts/docs.njk |
Documentation with sidebar TOC |
layouts/post.njk |
Blog posts (if using blog) |
Markdown Content
Markdown files are processed with Nunjucks, so you can use template features:
# {{ title }}
Published on {{ date | readableDate }}
## Section Heading
Regular markdown content here.
{% include "partials/cta.njk" %}
Collections
Define collections in eleventy.config.js:
eleventyConfig.addCollection("posts", function (collectionApi) {
return collectionApi
.getFilteredByGlob("src/content/posts/**/*.md")
.filter((item) => !item.data.draft)
.sort((a, b) => b.date - a.date);
});
Data Cascade
Eleventy merges data from multiple sources (highest priority first):
- Frontmatter in the template
- Template-specific data file (
page.11tydata.js) - Directory data file (
posts.json) - Global data files (
_data/*.json)