This is our very first post on MakeWithHugo.com - where we are going to make tutorials on how to create, work with and adapt websites built with Hugo.
A Bit of Background
Hugo is a static site generator built in Go. It is fast and extendable and a good choice for building a static (html-based sites). It does, however, have some nuances that requiring some research as they’re not immediately obvious. This is what we’re trying to help with.
Edd is a PHP and Go developer who enjoys blogging about his experiences, mostly about creating and coding new things he's working on and is a big beliver in open-source and Linux.
Add a 404 Not Found Page
–
In an ideal world, every web page would exist, but sometimes links go to pages that doen’t exist. This is why we make “404 - not found” pages. In Hugo you can do the same. Many of our sites are hosted with Netlify which also support these files - automatically returning the correct http status code for them.
To make yours, you can add a file into your layouts folder.
Deploy a Hugo site to Netlify
–
Netlify is a convenient hosting platform for staticly built sites, like those built with Hugo, as it offers fast and cheap delivery of HTML files. In this tutorial, we will quickly run through how you can take your site from your local computer and push it out to the world-wide web.
Make a Static Page in Hugo
–
Hugo is built with blogs in mind, and as such the pages you create will often show in the loop of blog posts. But there are times when you want to create pages - which aren’t posts - and you don’t want them to show unless you link to them. We recently came across this scenario when trying to add a privacy policy page.
Here’s our solution to the problem (using the privacy policy as an example).