Format a Markdown file for Gatsby.js v1

Taylor Bell
InstructorTaylor Bell
Share this video with your friends

Social Share Links

Send Tweet

Gatsby looks at the “front matter” at the top of each Markdown file when building your blog. In this lesson, we’ll create a few dummy posts with all the necessary information.

Instructor: [00:00] Gatsby will look for markdown files in source/pages, so let's go there. I'm going to make a folder that's year/month/day and then a slug. Now we'll cd into the directory, and I am going to write a file, index.md, which will be our blog post.

[00:17] The way that Gatsby works is it converts the front matter inside of the markdown file into usable HTML data. So we do a separation of three dashes. We'll add a path, which is going to be the URL that we'll be able to access the post at.

[00:30] And then we'll do a date -- and we just use a Unix timestamp here -- title, which will be the title. Then we'll add an array of tags, and then an excerpt, which we'll be able to use on the home page. Then we can go ahead and write markdown.