Hugo Introduction

My blog has been built with hexo before. As I use golang more and more, I have always wanted to migrate my blog to hugo. Hugo is a static website generator written in golang, which is simple, easy to use, efficient, easy to expand and quickly deployed.

Install hugo

Here is an example of mac environment:

1
2
3
4
5
6
brew install hugo
hugo new site wanzi
cd wanzi
git clone https://github.com/xianmin/hugo-theme-jane.git --depth=1 themes/jane
cp -r themes/jane/exampleSite/content ./
cp themes/jane/exampleSite/config.toml ./

Modify the config.toml information to your own blog information

My website directory structure is as follows:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
.
├── LICENSE
├── archetypes #Store default.md, header file format
│   └── default.md
├── config.toml
├── content #Global configuration of the entire website project
│   ├── about.md
│   └── post
├── data #Store data or configuration, can be json|toml|yaml
├── layouts #Store the template file of the website
├── public #Static files generated after hugo compilation
│   ├── 404.html
│   ├── about
│   ├── atom.xml
│   ├── categories
│   ├── css
│   ├── favicon.ico
│   ├── fonts
│   ├── icons
│   ├── index.html
│   ├── js
│   ├── manifest.json
│   ├── mark
│   ├── posts
│   ├── robots.txt
│   ├── rss.xml
│   ├── sitemap.xml
│   └── tags
├── resources
│   └── _gen
├── static #Store images, css, jss static resources
└── themes #Store website themes
└── jane

Write an article

1
hugo new content/posts/git-commands-base.md

Push to github

1
2
3
4
5
6
7
cd wanzi/public
git init
git remote add origin https://github.com/iwz2099/wanzi
echo "wnote.com" > CNAME
git add -A
git commit -m "initialization"
git push -u origin master

If you use a personal domain name, you only need to create a CNAME file under the github repository and write your own domain name. In this way, you can visit your blog by visiting wnote.com.