Skip to main content
Blog posts are the core of your content strategy. They’re stored in src/content/blog/ as markdown files with frontmatter defining metadata.

Blog Collection Schema

The blog collection is defined in src/content.config.ts with the following schema:
string
required
The title of your blog post. This appears as the main heading and in meta tags.
string
required
The author’s name (e.g., “Lewis Kori”)
array
required
An array of tag strings for categorization (e.g., ["Writing", "Learning", "Clarity"])
string
required
A brief summary of the post. Used for SEO meta descriptions and post previews.
date
required
Publication date in YYYY-MM-DD format (e.g., 2025-09-16)
string
Optional path to a cover image for the post (e.g., /blog/my-post-cover.jpg)
string
Optional series name to group related posts together (e.g., "Human + AI")
array
Optional array of sponsor names (e.g., ["Scraper API"])
string (URL)
Optional canonical URL if the post was originally published elsewhere

Creating a New Blog Post

1

Create a new markdown file

Navigate to src/content/blog/ and create a new .md file. Use kebab-case for the filename:
2

Add frontmatter

Start your file with YAML frontmatter containing all required fields:
3

Write your content

Below the frontmatter, write your post content using markdown:
4

Preview and publish

Run your development server to preview the post:
The post will be automatically available at /blog/my-new-post

Working with Series

Series allow you to group related blog posts together. When you add a series field to your frontmatter, posts with the same series name will be linked together.

Example: Creating a Series

All posts with series: Human + AI will be automatically grouped and can be displayed together on your site.

Adding Sponsors

If your blog post is sponsored, you can list sponsors in the frontmatter:
You can also use an empty array if there are no sponsors:

Real-World Examples

File Organization

Blog posts are stored in src/content/blog/ with the following structure:
The filename becomes the URL slug. For example, why-i-write.md will be accessible at /blog/why-i-write

Best Practices

  1. Use descriptive filenames - Keep them concise but descriptive, using kebab-case
  2. Write clear descriptions - Your description is used for SEO and social media previews
  3. Tag strategically - Use 3-6 relevant tags that help categorize your content
  4. Set accurate dates - The dateCreated field determines post ordering
  5. Optimize images - If using cover_image, ensure images are optimized for web
  6. Group with series - Use series to create cohesive content collections

Querying Blog Posts

In your Astro components, you can query blog posts using the Content Collections API: