Consume a Theme in a Gatsby Application

Jason Lengstorf
InstructorJason Lengstorf
Share this video with your friends

Social Share Links

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 json.af/party. 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.

egghead
egghead
~ 20 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today