Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.


    Build a Blog with React and Markdown using Gatsby Update

    Format a Markdown file for Gatsby.js v1


    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.



    Become a Member to view code

    You must be a Pro 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
    orLog In




    Instructor: 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.

    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.

    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.