@@ -43,7 +43,7 @@ Make sure all dependencies have been installed:
43
43
Set up Contentful:
44
44
45
45
- Create a new and preferably empty space.
46
- - Generate API Keys for content delivery and preview tokens.
46
+ - Go to * "Settings > API keys" * and add an API key for content delivery and preview tokens.
47
47
- Log in to your account by running ` npx contentful-cli login ` .
48
48
49
49
## Getting started
@@ -68,6 +68,36 @@ After that, you can try out the new app. To do so, change to the newly created d
68
68
you selected. You can also start the Hugo development server by running ` npm start ` . However,
69
69
you will only see an empty page because no entries have been created in Contentful yet.
70
70
71
+ Nice job so far. Now you can easily deploy your site to Netlify.
72
+
73
+ First, push the app to GitHub:
74
+
75
+ ```
76
+ # Replace the origin with the correct URL to your repo
77
+ git remote add origin [email protected] :{ACCOUNT}/{REPO}.git`
78
+ git branch -M main
79
+ git push -u origin main
80
+ ```
81
+
82
+ Create and configure a continuous deployment for a new site in Netlify:
83
+
84
+ - Log in to your account by running ` npx netlify login ` .
85
+ - ` npx netlify init ` configures a continuous deployment for a new site.
86
+ - And ` npx netlify env:import .env ` imports the current environment variables.
87
+
88
+ And last but not least we set up a webhook in Contentful:
89
+
90
+ - Netlify: Go to * "Site settings > Build & deploy > Build hooks"* , add a new build hook and copy it.
91
+ - Contentful: Go to * "Settings > Webhooks"* , add a new webhook and change the following settings.
92
+ - URL: Paste the copied Netlify build hook URL
93
+ - Triggers: Select specific triggering events
94
+ - Content Events: Select only * Publish* and * Unpublish* for * Entry*
95
+ - Filter: Add a new filter * Entity ID (sys.id) equals* with * deploy-to-production*
96
+
97
+ You are now ready to deploy. Open the * "Deploy to production"* content entry and click * Deploy* .
98
+ Switch to Netlify and check whether the webhook has run in. The build should now start
99
+ and after a short while... ** Site is live ✨**
100
+
71
101
## Get involved
72
102
73
103
[ ![ PRs Welcome] ( https://img.shields.io/badge/PRs-welcome-brightgreen.svg?maxAge=31557600 )] ( http://makeapullrequest.com )
0 commit comments