In this lesson we learn how to install our theme in a new project and add data to it.
Open up your terminal, move into a new folder, and create a new directory called theme-test:
Change directories to this new directory:
Set up the project:
bashyarn init -y
Now add your packages, including the theme you just made:
bashyarn add react react-dom gatsby @<npm_username>/<theme_name>
Note: If you didn't publish a theme, use @jlengstorf/gatsby-theme-events instead. Open up your theme-test folder and make a gatsby-config.js.
Inside, create a module.exports, and add your theme in the plugins array:
Run the following in termianl:
yarn global add gatsby-cli
To start the site, run the following in the terminal at the
At localhost:8000, we can see our theme installed.
To add some data, create a
data/events.yml in the root project folder.
- name: Party location: My House start_date: 2019-06-26 end_date: 2019-06-26 url: https://jason.af/party
Back at localhost:8000 we can see our event displayed with just a few lines of code.