2026 Community Survey results are here! See how the Craft CMS community works. results are live!

Creating and Displaying Content with Markdown

The simplest way to add content to an Astro site is to use Markdown. Here's how to do it.

The sim­plest way to add con­tent to an Astro site is to use Mark­down. This isn’t like­ly how you’ll use Astro if you plan to pow­er it entire­ly with con­tent from Craft CMS. How­ev­er, you can com­bine mark­down and Craft CMS sources of con­tent, so this will still be handy to know and understand.

With Astro, you can use either:

  • stan­dard mark­down or 
  • MDX, an enhanced fla­vor of mark­down that sup­ports using JavaScript expres­sions and com­po­nents right inside the mark­down files. This would be clos­er to work­ing with a typ­i­cal Astro com­po­nent ver­sus a sim­ple Mark­down file.

To use MDX, we will need to use the Astro MDX inte­gra­tion. We’ll set that up in the next video.

Stan­dard mark­down and MDX files can be placed in the pages direc­to­ry and made auto­mat­i­cal­ly routable to a URI based on the file name. 

And, we can define and store data about the mark­down file in the front­mat­ter. This is a great place to put a title, author, or oth­er meta­da­ta about the arti­cle or content. 

We want to cre­ate a Dis­claimer page on the real estate site for our project. We’ll do that using a sin­gle routable file in the pages direc­to­ry. Instead of it being an Astro com­po­nent, we’ll cre­ate a mark­down file.

Craft Version
Craft 4
Instructor
Ryan Irelan
Level
Beginner
Date Published
March 24, 2023
Ryan Irelan

I am the creator of CraftQuest, a web developer, and former software team manager. I spend most of my time improving CraftQuest with code and courses. When I'm not in front of the computer, I spend my time with my family, and running on the roads and trails of Austin, TX.