Shopify's Hydrogen Starter with Contentful
Run the following command to create a new Hydrogen storefront:
The CLI will ask a few questions around how you’d like to configure the project. These are suggested answers if you are new to Hydrogen and want to get un and running quickly. If you are more familiar, feel free to change your responses to more appropriately meet your needs, though this guide does not cover the changes or additional answers you may need to provide as a result.
Once complete, Hydrogen will display the next steps.
Navigate to your project folder and start the development server:
Create a new route file for Contentful integration:
Add the following code to fetch and display data from Contentful:
First, Update the CSP header to include Contentful's CDN, by adding (pay attention to the START/END comments in the following code block) the following code block:
Next, change the following line later in this file to use this new updatedHeader, before:
and after you've made the change: