2 min read
How to Add New Posts

Adding a new blog post is simple. All content is stored in the src/content/blog directory as Markdown files.

Steps

  1. Create a new file: Create a new .md file in src/content/blog. The filename usually corresponds to the slug of the post (e.g., my-new-post.md).

  2. 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 in YYYY-MM-DD format.
    • draft: Set to true to hide the post from the build; false to publish it.
  3. 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!