Create a new blog post in the src/content/blog/ directory.
Steps
- Take the title from the user's argument. If no title is provided, ask for one.
- Generate a kebab-case filename from the title (e.g., "My First Post" →
my-first-post.md). - Get the author name by running
git config user.name. Fall back to "Author" if not set. - Create
src/content/blog/<slug>.mdwith this frontmatter:
---
title: "<title>"
description: "<ask user or generate a one-sentence summary>"
author: "<git user.name>"
publishedAt: <today's date YYYY-MM-DD>
tags: []
draft: true
---
Write your post content here.
- Tell the user:
- The file was created at
src/content/blog/<slug>.md - The post is in draft mode — set
draft: falsewhen ready to publish - They can add an optional
imagefield to the frontmatter for a hero image - Tags can be added as an array of strings:
tags: ["astro", "tutorial"]
- The file was created at