Adding a new blog post is simple. All content is stored in the src/content/blog directory as Markdown files.
Steps
-
Create a new file: Create a new
.mdfile insrc/content/blog. The filename usually corresponds to the slug of the post (e.g.,my-new-post.md). -
Add Frontmatter: At the top of the file, add the required metadata (frontmatter) enclosed in
---.--- title: "Your Post Title" description: "A short description of your post." date: "YYYY-MM-DD" draft: false ---title: The title of the blog post.description: A brief summary used in post lists and SEO.date: The publication date inYYYY-MM-DDformat.draft: Set totrueto hide the post from the build;falseto publish it.
-
Write Content: Write your blog post content below the frontmatter using standard Markdown syntax.
Example
---
title: "My Awesome Day"
description: "Reflecting on a productive day of coding."
date: "2024-05-22"
draft: false
---
Today I learned how to use Astro content collections... Comments
No comments yet. Be the first!