Skip to content

Commit 1d1595f

Browse files
author
drewgo
committed
add hugo version without this build fails in netlify
1 parent dda8b89 commit 1d1595f

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

content/docs/hugo.md

+40
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,46 @@ collections:
106106
107107
**Note:** You won't be able to access the CMS just yet — you still need to deploy the project with **Netlify** and authenticate with **Netlify Identity**. You'll handle this in the next few steps of this guide.
108108
109+
### Configuring Netlify Build Settings
110+
111+
To ensure consistent builds on Netlify, create a `netlify.toml` configuration file at your project's root with these settings:
112+
113+
```toml
114+
[build]
115+
command = "hugo"
116+
publish = "public"
117+
118+
[context.production.environment]
119+
HUGO_VERSION = "0.128.0"
120+
```
121+
122+
This configuration:
123+
124+
1. Specifies the exact Hugo version Netlify should use (match this to your local Hugo version)
125+
2. Defines the build command that generates your site
126+
3. Sets the publish directory to Hugo's default output folder
127+
128+
**Note:** Explicitly setting the Hugo version prevents unexpected build issues from version mismatches between your local environment and Netlify's auto-detected version.
129+
130+
### Configuring Netlify Build Settings
131+
To ensure consistent builds on Netlify, create a `netlify.toml` configuration file at your project's root with these settings:
132+
133+
```toml
134+
[build]
135+
command = "hugo"
136+
publish = "public"
137+
[context.production.environment]
138+
HUGO_VERSION = "0.128.0"
139+
```
140+
141+
This configuration:
142+
143+
1. Specifies the exact Hugo version Netlify should use (match this to your local Hugo version)
144+
2. Defines the build command that generates your site
145+
3. Sets the publish directory to Hugo's default output folder
146+
147+
**Note:** Explicitly setting the Hugo version prevents unexpected build issues from version mismatches between your local environment and Netlify's auto-detected version.
148+
109149
### Pushing to GitHub
110150

111151
It's now time to commit your changes and push to GitHub. You can run the following commands to initialize a git repository and push the changes so far.

0 commit comments

Comments
 (0)