2 min read

[Old] Blog Collection

Table of Contents

Working with the blog collection:

The blog collection is found in src/content/blog.

๐Ÿ“ /src/content/blog
โ””โ”€โ”€ ๐Ÿ“ post-1
      โ””โ”€โ”€ ๐Ÿ“„ index.md
โ””โ”€โ”€ ๐Ÿ“ post-2
      โ””โ”€โ”€ ๐Ÿ“„ index.mdx

In the above example, two blog posts will be generated with the folder name representing the slug.

  • https://example.com/blog/post-1
  • https://example.com/blog/post-2

Provide metadata

Metadata is required for each post.

---
title: "Blog Collection";
description: "How to add posts to the blog.";
date: "2024-03-21";
draft: false;
---
FieldReqTypeRemarks
titleYesstringTitle of the content. Used in SEO and RSS.
descriptionYesstringDescription of the content. Used in SEO and RSS.
dateYesstringMust be a valid date string (able to be parsed).
draftNobooleanIf draft: true, content will not be published.

All thatโ€™s left to do is write the content under the metadata.

---
title: "Blog Collection";
description: "How to add posts to the blog.";
date: "2024-03-21";
draft: false;
---

## Working with the blog collection
<!-- content -->