In this tutorial we will setup a Hugo Blog with the Kiera theme on Linux and will be using Ubuntu for this demonstration, but since Hugo runs on Go, you can run this on Windows, Linux or Mac.
Dependencies
We require git to download the theme from github, so first update your package managers indexes, and install git:
After sourcing the profile we should see the hugo version:
123
$ source ~/.profile
$ hugo version
Hugo Static Site Generator v0.72.0-8A7EF3CF linux/amd64 BuildDate: 2020-05-31T12:07:45Z
Create the Hugo Workspace
Create the directory where we will host our blogs and change into that directory:
12
$ mkdir -p ~/websites
$ cd ~/websites
Create your site with hugo:
123
$ hugo new site awesome-blog
Congratulations! Your new Hugo site is created in /home/ubuntu/websites/awesome-blog.
Visit https://gohugo.io/ for quickstart guide and full documentation.
After config has been applied to ./config.yml and we start our server up again:
1
$ hugo server --theme=kiera --bind=0.0.0.0 --environment development
We should see this:
Create your First Post
Creating the first post:
12
$ hugo new posts/my-first-post.md
/home/ubuntu/websites/awesome-blog/content/posts/my-first-post.md created
Let’s add some sample data to our markdown file that hugo created:
123456789
+++
title = "My First Post"
date = 2020-06-14T15:47:17+02:00
draft = false
tags = ["hugo", "kiera"]
categories = ["hugo-blog"]
+++
-> markdown content here <-
When starting the server up again and viewing the home page:
And selecting the post:
Code snippets:
Tables, lists and images:
Creating Pages
For the pages section (about, getting-started), we first create the directory:
1
$ mkdir content/getting-started
Then create the page under the directory:
12
$ hugo new content/getting-started/index.md
content/getting-started/index.md created
The content:
12345678
$ cat content/getting-started/index.md
---
title: "Getting Started"
date: 2020-06-14T16:11:07+02:00
draft: false
---
This is a getting started page
When we start up our server again and select the “getting-started” from the navbar on our home page:
Production Mode
You can set the flags in your main config as well, but running the server in production mode:
12345
$ hugo server \
--baseURL "http://192.168.64.17/" \
--themesDir=themes --theme=kiera \
--bind=0.0.0.0 --port=1313 --appendPort=true \
--buildDrafts --watch --environment production
Thanks
Thanks for reading, feel free to reach out to me on @ruanbekker