Join egghead, unlock knowledge.

Want more egghead?

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock This Lesson

Already subscribed? Sign In

Autoplay

    Build a Blog with React and Markdown using Gatsby Update

    Format a Markdown file for Gatsby.js v1

    Taylor BellTaylor Bell

    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.

    gatsbyGatsby
    Code

    Code

    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    Transcript

    Transcript

    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.

    Discuss

    Discuss