How to write a blog post in Markdown in Astro

Side Quest theme homepage
Side Quest: Personal journals with dated timelines

You can write a blog post in Markdown in Astro by adding a content file with the fields required by your template, then previewing and building the result. This guide uses an example blog template running Astro 7.3.3. Its folder names, post addresses, author default and draft behavior are specific to that template, so check your own README and collection schema before adapting the steps.

The article text is only one part of the file. Frontmatter supplies details such as the title and date, and the collection schema decides which details are required. Keeping the terminal visible while you edit helps you catch validation errors that may not replace the page currently shown in the browser.

Steps to write a blog post in Markdown in Astro

1. Find the collection and read its schema

In the example template, posts live in src/content/stories as Markdown files, with an MDX file also present. The collection is defined in src/content.config.ts. Its loader picks up .md and .mdx files from that folder, and its schema lists the fields each entry can contain.

For this example, title, description, date and category are required. Optional fields include updated, tags, author, cover, coverCaption, featured, draft, unlisted and noindex. Tags default to an empty list, and author defaults to the site’s editor. These are the example’s rules, so inspect your own schema before copying an entry from a different template.

2. Choose a file name

Create src/content/stories/my-first-post.md in the example project. Its file name becomes the post’s address at /journal/my-first-post/. This relationship gives the file name a public purpose: choose it with the article in mind rather than treating it as a temporary label that nobody will see.

Keep an existing post open as a reference for the template’s conventions. Use that reference to understand its structure without carrying unrelated content into the new article. If your local server is not running yet, the Astro installation guide covers installing dependencies and starting development from the project folder.

3. Add the required frontmatter

Frontmatter belongs between two lines of three dashes, before the article body. The following short example supplies the required fields and a tags list for this template. Replace the title, description, date and category with details that fit your own article and schema.

---
title: "My first post"
description: "I describe a morning walk and the observations I brought home."
date: 2026-09-23
category: Essays
tags: [Notes]
---

Write the description as a useful introduction to the article. In this template it appears beneath the headline, so it should help a reader understand what follows. Do not omit a required field merely because the body already explains the same subject in more detail.

4. Write short Markdown sections

Write paragraphs beneath the closing frontmatter line. Two hash signs create a subheading, pairs of asterisks mark bold text, and single asterisks mark italic text. A hyphen begins a bulleted list item. Keep the actual prose in complete sentences, even when the syntax is compact.

## I noticed the path had changed

The **lower trail** was quiet, and the air felt *cool*.

- I stopped beside the stream to make a note.
- I followed the upper path on the way home.

Use headings to signal real changes of subject. A short post may need only a small amount of formatting; read it as an article before adding more emphasis. Formatting should make the sequence of observations easier to follow, rather than distracting from the writing.

5. Add a useful link and image

Markdown links place the visible text in square brackets and the destination in parentheses. For example, the following syntax points to a related reading page with a descriptive label.

I used the [local setup guide](https://peachfinthemes.com/how-to-install-an-astro-template-and-run-it-locally/) before drafting this post.

An image uses an exclamation mark before its bracketed alternative text, followed by the relative photo path in parentheses. In this example template, the image points to a photo in src/assets/photos, and Astro processes it. Describe the image for people who cannot see it, and check your own template’s image instructions before choosing the path.

6. Save and check the terminal and browser

With the development server running, save the file. In the example, the terminal reports “Reloaded data from my-first-post.md” and the browser reloads automatically. The new article appears in the homepage’s recent posts band and the Journal list according to its content and date.

Open the article itself and check its headline, description, date and formatted text. When no author is supplied, this template displays the site’s default editor. If a required field is missing, Astro 7 may keep showing the last good browser version while the terminal reports a schema error. Read the terminal even when the page still looks normal.

7. Review drafts and check the build

In this example template, adding draft: true leaves the article previewable in development with a draft or scheduled notice. It disappears from the homepage and Journal lists, and production builds leave it out. Setting draft to false or removing the line makes it eligible for publication; other templates may handle this differently.

When the entry is ready, run npm run build. A missing required description stops the example build with InvalidContentEntryDataError and identifies the field and file. Restore the required line and restart development with npm run dev to check the corrected entry, then run the build again. Review the built output locally before proceeding to your separate deployment workflow.

Common problems

Older article version in the browser

Read the terminal for a collection schema error. In Astro 7, a missing required field can leave the last good version visible without a browser error overlay. Correct the reported field and check again.

Post absent from the lists

Check draft in the example template’s frontmatter. Its draft behavior allows development preview while excluding the post from the homepage, Journal list and production build.

InvalidContentEntryDataError during the build

Read the field and file location in the error, then compare the entry with the schema in content.config.ts. Restore the missing required information and rebuild rather than judging success from the browser alone.

FAQ

Must I include frontmatter to write a blog post in Markdown in Astro?

For the example collection, the required title, description, date and category belong in frontmatter. Your own collection schema determines which fields your template requires.

Will every Astro template use a stories folder?

The stories folder belongs to this example. Check the README and content.config.ts for your template’s collection location.

Does omitting author leave the example article unnamed?

The example schema defaults author to the site’s editor. Another template can define different defaults, so check its schema before relying on that behavior.

Summary

Start with the collection rules, give the file a useful name and supply its required frontmatter. Write the body, inspect the terminal during preview and verify draft behavior before building. A successful build is part of checking the entry, especially when the browser can retain an older valid version.

The Astro blog template collection provides context for organizing a publication around content files.