Why hugo
- Easy.
- Fast.
- Popular.
- Support markdown.
- Github as your blog CMS.
Install hugo
Download the latest release from Hugo Github release page and install on your machine.
I’ve tried to build the hugo from source, but the latest version will be
v60
, while the latest release version of hugo on the Github isv110
, so I highly recommand you download the release pkg from Github release page!
Select a theme for you blog
There’re so many themes for you to choose on Hugo Themes page.
But too much themes without rates/stars lets me be dazzled. So I found a community ranking here:
It sorts hugo themes by Github stars.
I choose “stack” theme eventually for the following reason:
- I prefer the flatten style.
- It support floating TOC which is useful for long articles.
- Well-supported for comment system.
- Also support searching content.
Set up hugo project
Create a new site
Create a new site with hugo
|
|
Init git
|
|
Setup your theme
Download the theme to your repo
|
|
Replace the config with example config file
|
|
Add a post
Create a post by hugo:
|
|
Paste these content and save:
|
|
Start the server
|
|
--bind=0.0.0.0
will make the site public, which is useful when you’re developing on a cloud
server without GUI.
Add Comment system
The “stack” theme supports many comment systems.
There’re two open source comment system that I prefered:
- utterance
- giscus
giscus
is a comment system based on Github Discussions, while utterance
is based on github issues.
For me, Github Discussions is a perfect place to hold all comments for blog.
Finnally I choose giscus
for my blog’s comment system.
Steps to config giscus
as your comment system:
- Make the repository public.
- Install the giscus app on your repo.
- Turn on the Discussions feature for your repository.
After these settings, you need to config giscus on your hugo project:
Fill all options on giscus site, you’ll get a script tag like this:
|
|
Let’s convert that into config.toml
:
|
|
Start the server and you’ll see the comment widgets on the bottom of your posts:
|
|