Once you’ve got your Hugo blog in GitHub, now’s the time to get it up and running.

What’s Netlify? An intuitive Git-based workflow and powerful serverless platform to build, deploy, and collaborate on web apps. Yeah, straight from their website. But in a nutshell, it’s simply a way to host applications built from a git repo, without have to manage any servers.

Why Netlify? It’s free! Well, at least for me it is. The process was so painless and simple, it is more of a question of why not?

As a reminder, this is what we are doing with our deployment. We are building our Hugo based website in a git repo on our local machine, pushing it to Github, and then Netlify will build from there. hugo deployment

To get started, we need to create a Netlify deployment file. We do this by creating a netlify.toml file in the root of our repo.

netlify.toml

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
[build]
publish = "public"
command = "hugo --gc --minify"

[context.production.environment]
HUGO_VERSION = "0.83.1"
HUGO_ENV = "production"
HUGO_ENABLEGITINFO = "true"

[context.split1]
command = "hugo --gc --minify --enableGitInfo"

[context.split1.environment]
HUGO_VERSION = "0.83.1"
HUGO_ENV = "production"

[context.deploy-preview]
command = "hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL"

[context.deploy-preview.environment]
HUGO_VERSION = "0.83.1"

[context.branch-deploy]
command = "hugo --gc --minify -b $DEPLOY_PRIME_URL"

[context.branch-deploy.environment]
HUGO_VERSION = "0.83.1"

[context.next.environment]
HUGO_ENABLEGITINFO = "true"

Once signed up for Netlify, simply follow the “New Site from Git” option to get started. You’ll follow the instructions to connect Netlify to GitHub (or Gitlab/Bitbucket), pick your repo, and it should prompt you with how you want to build.

netlify site

And you’re done! You can now view the deploy happening automatically, you can debug what it is doing as well. By default this will create a site that has a Netlify domain name. Next steps now would be to enable your domain at Netlify, or create a CNAME entry from your domain to Netlify.