This article shows how to deploy your site to Netlify.

Netlify Configuration§

Create a netlify.toml in the site root:

 1[build]
 2  publish = "public"
 3
 4[build.environment]
 5  NODE_VERSION = "17.6.0"
 6  HUGO_VERSION = "0.101.0"
 7  HUGO_ENABLEGITINFO = "true"
 8  GO_VERSION = "1.17.7"
 9
10[context.production]
11  command = "npm install && hugo --minify"
12
13[context.production.environment]
14  HUGO_ENV = "production"
15
16[[headers]]
17  for = "/*"
18  [headers.values]
19    Referrer-Policy = "strict-origin-when-cross-origin"
20    X-Content-Type-Options = "nosniff"
21    X-Frame-Options = "deny"
22    X-XSS-Protection = "1; mode=block"
23
24[[redirects]]
25  from = "/:lang/*"
26  to = "/:lang/404.html"
27  status = 404
28
29[[redirects]]
30  from = "/*"
31  to = "/en/404.html" # Replace the "en" to your default language code if "defaultContentLanguageInSubdir" is enabled, otherwise use "/404.html" instead.
32  status = 404

See also Starter Template Netlify Configuration.