Many of you have been asking about the best way to build a static site with Contentful. And while we don’t like to play favorites, we do have a recommendation for how you can get going with Contentful and Gatsby, a static site generator for React.
-“I wanted these videos to act as documentation,” says Khaled. -“There were a lot of people asking around about how to do this. And I think it’s important to show not only how to do this thing with Gatsby or how to do that with Contentful, but from start to finish how you can actually deploy, use webhooks, and so on. These are hidden gems that not everyone will look for.”
Those hidden gems Khaled is talking about, those are part of what he believes makes Gatsby and Contentful a compelling combination. Additionally, there are structural aspects of both platforms that add to this: -“Gatsby works with React and React is component-based. And you can also think of Contentful in this way, if you think of your content as components” he explains. -“So that’s made a really perfect match because you can have this component that renders a specific content type and then this can be shared across your website.”
Another unique distinction is the complementary ways Contentful and Gatsby process data. -“Contentful has the sync endpoint, so this can actually improve the ability to process a lot,” Khaled says. -“Because the first time, you get all of the data. The next time, you only get the entries that changed so it takes less time to parse the JSON and so on. Also Gatsby is good because all of the data you have from Contentful would be in a GraphQL schema, so you can query your data that way.”
Ready to dive in? All four parts of Khaled’s video series are now available on YouTube. You can also find the source code on GitHub.
Additionally, we also have a gatsby-contentful-starter repo for you to clone to get your first Contentful and Gatsby-powered blog up and running in no time.