3 min read

Collections guide

Steo-by-step guide on adding a blog post or other entry

Table of Contents

Collection names

Originally, there are three collections:

  • blog
  • projects
  • talks

They work pretty much the same. If the collection is empty, the UI doesnโ€™t show it.

For adding new collections, see the source code and follow the same pattern.

Adding content to the collection

The collectionโ€™s content is located in src/content/COLLECTION.

Inside, add a folder with your content in index.mdx (or index.md) file.

๐Ÿ“ /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 entry.

---
title: "How to add a blog post";
description: "Steo-by-step guide on adding a blog post";
date: "2024-03-21";
lastUpdateDate: "2025-01-13";
ogImage: "/images/article-og-image.png"
draft: false;
tags:
  - guide
  - important
---
  • title - will be used as header, placed in metadata and RSS.
  • description - (optional) will be used as a subtitle, placed in metadata and in RSS. If missing, the global page description will be used in the metadata.
  • date - publish date in format: YYYY-MM-DD
  • lastUpdateDate - (optional) date of the last update in format: YYYY-MM-DD
  • ogImage - (optional) path (relative to the public folder) to the open graph image for this entry
  • draft - (optional) if true, the entry wonโ€™t be included into final build
  • tags - (optional) list of tags.
โ„น๏ธ

Itโ€™s not required, but itโ€™s recommended to keep the title as the URL-friendly version of the post title. According to this guide, the index.mdx with the above content should be placed in src/content/blog/how-to-add-a-blog-post.


Write content

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

---
title: "How to add a blog post";
description: "Steo-by-step guide on adding a blog post";
date: "2024-03-21";
lastUpdateDate: "2025-01-13";
ogImage: "/images/article-og-image.png"
draft: false;
tags:
  - guide
  - important
---

## Before adding a blog post...
<!-- content -->

Content is expected to be in the Markdown format (MDX allowed in index.mdx).

Read more:


Order

The order of the entries is determined by the date field. The newest entries will be displayed first.

However, if lastUpdateDate is present, the entry will be sorted by this field instead.


John Doe
Hi, I'm John Doe

Astro Milidev is a minimalistic portfolio+blog Astro theme.

It originates from Trevor Lee 's Astro Micro theme, which is based on Mark Horn 's Astro Nano (after "nano" and "micro" comes "mili", hence the first part of the name).

Astro Milidev enhances the above codebases with a variety of features. I customized the original theme for my personal website, and also refactored core parts of the code, making it more customizable and extensible.

The changelog is available in this post: Everything new in Astro Milidev . Another post Getting started explains the configuration process step by step. The code is MIT-licensed and available on GitHub .

Enjoy!

Contact me:

email@example.com | @BillGates on X | GitHub | LinkedIn


Content licenced under CC BY-NC-ND 4.0