Why even#

Some cat pictrue

I wanted to start my own programming blog™ since, like, forever.

While there are a myriad of solutions out there I could use, like Medium, dev.to, Twitter, or LinkedIn,
to name a few, I do have a bit of an obsession with self-hosting things on the Internet.

So when Hugo finally caught my eye, I decided it was my time to contribute to the global network clutter.

Hugo#

Hugo is a static website generator that consumes Markdown files to generate your pages – awesome!
It’s also dead simple to install and use.
Most of it is covered in the Getting Started Guide.

All you need to do is get the CLI (I use arch btw):

pacman -S hugo

Then navigate to the directory for your site and run:

# Generate files/directories
hugo new site mysite
cd mysite

git init

# Init theme. You can browse for some themes here: https://themes.gohugo.io/
git submodule add https://github.com/panr/hugo-theme-terminal

# Set the theme in the main config file
echo "theme = 'terminal'" >> hugo.toml

Configure#

Open the hugo.toml file in the project root and edit it to your liking.
For example, you might want to tweak these:

baseURL = 'your-url'
languageCode = 'en-us'
title = 'your-title'

Serve#

We can serve the site by running:

hugo server -D

This will spin up a server with the website, that will also detect file changes,
which is really handy during development.

The -D flag will also build your draft pages (see below).

Adding Pages#

To add a page, we can issue the CLI command again:

hugo new content content/posts/my-page.md

This will create a markdown file in content/posts.
Just throw your content in there.

+++
title = "My Page"
date = "2020-01-01T12:00:00+00:00"
author = "You"
cover = false
tags = ["your-tag"]
description = "Hello World! Up and running with Hugo."
showFullContent = false
draft = true
+++

Hello!

Note the draft=true value. Make sure to set that to false to publish your page.

Wrapping up#

That’s it! We could now run:

hugo

This will generate the static website itself – it will be placed in the public directory.

If you want to deploy that to the cloud, see this.
Otherwise just serve the public folder with something like nginx.

Well, there it is, hopefully of some use, thanks for reading!