Posted at: 2020-08-29 01:30 CEST
Length: 448 words (3 minutes)
Tags: [ web code ]
There was the question of what I was going to use for my new site and progress log. In the past I had always built my own, hand-coding HTML or - eventually - build my own CMS system in PHP - because that's what I enjoy doing, building systems, not necessarily using them (I'm not very good at producing content).
I have dabbled in Wordpress, but find it rather clunky and annoying, so I kept looking for something nicer to work with.
To begin with, articles, posts, whatever you want to call them, are typed in a simple language called Markdown. Add some metadata to the start of the file (see example from this very post), and it's ready to be processed by hugo.
--- title: A new website date: 2020-08-29T12:00:00+02:00 draft: true --- # Where to start? There was the question of...
So that's how to write something, but how do I use it?
Unlike many CMSes, hugo isn't run on the server (could be, but generally isn't), instead it's installed on the workstation. I run Arch Linux on my main machine, so I install it as such:
$ sudo pacman install hugo
Then I set up a base directory for my site:
$ hugo new site MySite
After that I initialise the directory as a git repository and fetch a theme to use.
$ cd MySite $ git init $ git submodule add https://github.com/vaga/hugo-theme-m10c.git themes/m10c
Edit the config file to personalise a bit:
baseURL = "http://www.ops-area.net/" languageCode = "en-gb" title = "Adventures in code and servers." theme = "m10c" [params] author = "Maighstir" description = "Hobbyist coder and sysadmin" [params.style] darkestColor = "#7d968a" darkColor = "#cfcfcf" lightColor = "#000d1e" lightestColor = "#0c0c0c" primaryColor = "#000"
Now I'm ready to start publishing by placing markdown documents in the content folder (or rather a subfolder, say, "
content/blog"). running "
hugo" from the base folder, and uploading the contents of the output folder (by default "
public") to the web host. I just use a shell script that runs hugo and then rsync to publish everything.
#!/usr/bin/env bash pushd src hugo popd rsync -avz --delete build/ www.ops-area.net:~/sites/blog/
And here I am. Apparently. Hello 👋.
<- Previous post | Next post ->
Copyright © 2020 Carl K.H.
Latest post at: 2020-09-07 07:00 CEST