Astro Quick-Start Guide

Content Collections in Astro

Content collections in Astro make it easier to manage Markdown or MDX content by organizing the markdown files into meaningful collections.

Before we move away from using mark­down files and switch over to feed­ing the Astro site con­tent from our Craft CMS project, let’s look at a new fea­ture in Astro 2: Con­tent Collections.

Con­tent col­lec­tions in Astro make it eas­i­er to man­age Mark­down or MDX con­tent by orga­niz­ing the mark­down files into mean­ing­ful col­lec­tions (think like a Sec­tion in Craft CMS) and val­i­dat­ing the data in the front­mat­ter via Typescript. 

One of the chal­lenges of writ­ing with mark­down is that the con­tent orga­ni­za­tion can get messy with a sea of mark­down files and no orga­ni­za­tion or way to query them eas­i­ly. Astro’s Con­tent Col­lec­tions tries to make that a bet­ter devel­op­er and author­ing experience.

Con­tent col­lec­tions live inside of the content direc­to­ry, and any mark­down or MDX file stored in that direc­to­ry — or one of its sub­di­rec­to­ries — will be part of a col­lec­tion. The content direc­to­ry is a spe­cial direc­to­ry and is required to use Con­tent Collections.

For the real estate mar­ket­ing site, we’re going to cre­ate a news con­tent col­lec­tion to house the Mar­ket News posts. 

Let’s get start­ed using Con­tent Collections!

Astro Quick-Start Guide is made up of the following videos: