Data & content · Lesson 10 of 22 · 10 min
Markdown pages and frontmatter
Write a page in Markdown, describe it with frontmatter, and wrap it in a layout.
Some pages are mostly words. Writing them in HTML is slow. Astro lets you drop a .md file into src/pages/ and it becomes a page.
1. Write the About page
src/pages/about.md
---
layout: ../layouts/MarkdownLayout.astro
title: About
description: Who cooks your food and why.
---
Sunday Supper Co. started with one long table and too much food.
## What we believe
- Cook with what's in season.
- Feed people like family.
- Leave the kitchen cleaner than we found it.
## Where we work
We cook across **Tuolumne County**. Want us somewhere else? [Get in touch](mailto:hello@example.com).
Frontmatter
The block between the --- lines at the top is frontmatter. It’s written in YAML: key: value pairs that describe the page.
layoutis special. It tells Astro which layout to wrap this page in.- Everything else (
title,description, anything you want) is passed to that layout.
2. Create the Markdown layout
The layout receives the frontmatter as a prop called frontmatter. The rendered Markdown goes into the slot.
src/layouts/MarkdownLayout.astro
---
import BaseLayout from './BaseLayout.astro';
const { frontmatter } = Astro.props;
---
<BaseLayout title={frontmatter.title} description={frontmatter.description}>
<article class="container prose">
<h1>{frontmatter.title}</h1>
<slot />
</article>
</BaseLayout>
<style>
.prose {
max-width: 680px;
padding-top: 2rem;
}
</style>
This is a nested layout: MarkdownLayout uses BaseLayout, so the About page still gets the header, footer, and global styles.
Visit /about. The nav’s About link is active now too.
Markdown cheat sheet
| Write | Get |
|---|---|
## Heading |
<h2> |
**bold** |
bold |
*italic* |
italic |
[text](url) |
a link |
- item |
a bullet list |
1. item |
a numbered list |
 |
an image from public/ |