Set up gatsby-theme-blog
in order to add pre-built blog functionality to your Gatsby site.
Laurie Barth: [0:00] Start with a working Gatsby site and install gatsby-theme-blog. Navigate to your gatsby-config file and add a new plugin. The name will be gatsby-theme-blog, and we're going to add an option.
[0:20] The option in this case will be basePath, which we can set to any path we like, in this case /blog. The default path is /, and since our site already has an index.js page, that takes up the space of / in our site.
[0:42] Create a directory called content and another directory called posts. Put a markdown file in it, that the theme will treat as an mdx file. Add a title to the front matter as well as a date. We can add some minor content to our markdown, save, and run the gatsby develop command.
[1:15] Once it's run, we can take a look at localhost:8000/blog and see that we have a listing page. We can click on our post and we'll see the full blog post available to us.
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
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!