Consume a Theme in a Gatsby Application

Jason Lengstorf
InstructorJason Lengstorf

Share this video with your friends

Send Tweet
Published 5 years ago
Updated 3 years ago

Install and configure your Gatsby theme to create a fully functional website from just a few lines of configuration and a folder full of MDX files.

For a written version of this course, check out the Gatsby docs.

Instructor: [00:00] To use the theme we've created, we're going to start from scratch. Let's make a directory called themeTest, and we move into it. Set up the project using yarn init -y. Let's add our dependency. We'll add React, React-DOM, Gatsby, and the theme that we just published.

[00:28] Open the theme in your preferred code editor. Create a Gatsby config.js. Inside, we'll do module.exports. In the plugins array, add your theme. Install the Gatsby CLI by running yarn global add Gatsby-CLI. Make sure you're in your themeTest directory and run Gatsby develop.

[01:14] Once the theme builds, go to localhost 8000. We can see that our theme is installed. Add some data to your theme by creating an events.yml. Inside the Yaml file, we need to create an event.

[01:30] We'll give it a name. We'll call it party. The location will be my house. The start date will be, I don't know, let's call it my birthday, we'll say June 26. This is going to be a short party. It's going to end on the same day.

[01:50] We need to set a url. That url will be After saving, we can switch over and see that it's already built and it's at the right place. Our theme works with just a few lines of code.