Icey One
My wish is to see you again, even across the world.
Why I choose Hugo?

Preface

My first website was built by WordPress, but WordPress is not specially developed for personal blogs, there are many functions that are completely unused, which slow down the loading speed. So I want choose a new framework for blog, between Hexo and Hugo I finally chose Hugo, here is why.

Hugo Hexo
Language Go Node.js
Plugins No Yes
HTML Anchor Yes No
Development Easy Hard

My blog is generally pure text, with few pictures. The requirement is fast loading and easy customization, so I choose Hugo. As the slogan: “The world’s fastest framework for building websites.” Hugo just spend 1988 ms to generate a site which 1000 pages, and Hexo need 5138 ms.

But Hexo has a great advantage as the most popular framework, there are many beautiful themes, such as Typography . I fell in love with it at first sight, but since it doesn’t support sidebar, I recommended it to Xia, and now it’s used in 永七茶話會 .

1. Download & Config

1.1 Download

Download Hugo and run hugp version to check whether the installation is successful. If successful, add hugo to the environment variables.

Then run hugo new site <sitename> to crate a new site, which file tree is like

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
<sitename>/
├── archetypes/
│   └── default.md
├── assets/
├── content/
├── data/
├── layouts/
├── public/
├── static/
├── themes/
└── config.toml

Here I recommend you change config.toml => config.yml, Because the yml file is highly readable.

Download theme your liked in themes folder, for example: PaperMod .

1
2
cd themes
git clone https://github.com/adityatelange/hugo-PaperMod.git

1.2 Config

Refer to the exampleSite folder to modify config.yml, for PaperMod, there is not built-in(Many themes come with it), we have to check PaperMod Example or Wiki .

Although different themes have different config.yml, the following are the same

1
2
3
4
5
baseURL: "https://www.icey.one" # base you domain
theme: hugo-PaperMod # used theme
title: PaperMod # Site name
author: Icey Swan # author name
description: "My wish is to see you again, even across the world." site description

2. Usage & Publish

2.1 Default Front Matter

Setting default Front Matter is very important, it can save our time, so we can focus on writing. open archetypes/_default.md

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
---
title: "{{ replace .Name "-" " " | title }}" 
slug: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }} #Crate time
lastmod: {{ .Date }} # Last modify time
author: Icey Swan #
categories: 
- cat1
-cat2
tags: 
- tag1
- tag2
description: 
weight: 1 # Enter 1 to pin this post, if blanked, it will be sorted by time
draft: false 
---

2.2 Commands

1
hugo [commond] [flags]

Here [flags] is optional, all available commands is following

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
completion  Generate the autocompletion script for the specified shell
config      Print the site configuration
convert     Convert your content to different formats
deploy      Deploy your site to a Cloud provider.
env         Print Hugo version and environment info
gen         A collection of several useful generators.
help        Help about any command
import      Import your site from others.
list        Listing out various types of content
mod         Various Hugo Modules helpers.
new         Create new content for your site
server      A high performance webserver
version     Print the version number of Hugo

Use hugo [command] --help for more information about a command.

Here are some commands

Crate new site

1
hugo new site <sitename>

Crate new post in content folder.

1
hugo new postname.md

Create a file at a specified location, such as posts/Tech/postname.md

1
hugo new posts/Tech/postname.md

Local preview webserver in 127.0.0.1:1313 or localhost:1313 , here -D means include content marked as draft.

1
hugo server -D

Use Hugo to render Markdown files into HTML.

1
hugo

hugo only crate new file in public folder, but don’t delete old. If you want delete that, run

1
hugo -F --cleanDestinationDir

2.1 Publish

All HTML files are ai public folder, upload the folder to site index on your server. If you want uploading to the hosting platforms, refer to hosting Hugo .

Here I recommend Banwagon or Vultr , if you want purchase a server.

Epilogue

From my experience, frameworks are unnecessary, the important thing is to keep writing. I know a lot of people, their website is very beautiful, but after half a year, if look at it again, you will find that he has not insisted on writing, and the website is deserted.