Sun, Oct 4, 2020
Check out or comparison page other options when finding the best blogging platform
Hugo is a Static site generator written in Go. It’s main selling point is speed.
Usual data backup warning here. I’m creating a new site, so if you have any content, make sure you have a backup!
wget https://github.com/gohugoio/hugo/releases/download/v0.76.3/hugo_extended_0.76.3_Linux-64bit.deb
sudo dpkg -i hugo_extended_0.76.3_Linux-64bit.deb
hugo version
hugo new site hugo-test
cd hugo-test
git init .
git submodule add https://github.com/budparr/gohugo-theme-ananke.git themes/ananke
cp -a themes/anake/exampleSite/* .
hugo new posts/my-first-post.md
hugo server -D
At this point I have content displaying. If you had trouble getting that working, check the troubleshooting section
git submodule add
or download the theme outside the source tree and use --themesDir
content
folder.content/<type>/
folder (I chose posts).I organize my content by category. Each category is a folder, with the posts under the category. This allows you to have landing pages for each category called _index.md
.
The content files are all split into 2 parts, the front matter and the content. The front matter is where Hugo gets parameter values to fill in the templates.
The front matter should look something like this:
---
title: "Post Title"
date: 2020-10-04T17:46:45-06:00
image: "posts/blogging/hugo-logo.svg"
draft: false
---
Supports the standard markdown syntax as well as a list of shortcodes.
static
folder, or as ofposts/dir1/dir2/myImage.png
. This image would be at content/posts/dir1/dir2/myImage.png
.Hugo has an archetypes folder that allows you to have templates for creating new content. Here’s what happens when you write hugo new posts/cool-new-post.md
:
archetypes/posts.md
archetypes/default.md
This is a great place for putting your post starter. Find a list of variables to use at https://gohugo.io/variables/page/
There are 2 ways to customize a theme
Essentially you’re creating a copy of a theme and modifying it in place. You’ll need to set up your own repository to save the changes, since you can push changes to the original theme.
This is typically the route you want to go if you can’t find any themes that are even close and you want to do a bunch of modifications.
If you don’t want to completely own the maintenance of the original theme you can just override parts of it. This is done by taking a file you want to change and copy it to the same folder in your directory.
For example if you want to add some javascript libraries. You can override themes/ananke/layouts/partials/head-additions.html
by creating a new file layouts/partials/head-additions.html
and adding your new code.
Hugo generates the sitemap for you, so you don’t have to worry about that.
I realized that I actually need hugo-extended for most of the themes to work since they all use scss. Installed hugo-extended, theme works better now, however I’m getting an error of:
ERROR 2020/09/28 21:15:14 render of “section” failed: list.html:29:59": execute of template failed: template: _default/list.html:29:59: executing “main” at <.Site.Params.dateFormat>: invalid value; expected string
Apparently my date format is “wrong”, didn’t realize I had added a date, but OK.
Looks like you have to copy the exampleSite/config.toml to your root to really get anything working.