Well this blog is created following the steps below.
Install Hugo
Install Golang
Hugo is written in Go, so we install Golang first.
|
|
And Golang is installed.
Add yum source
There is no Hugo package in official yum source, so we need to add the yum source first. Create hugo.repo in yum repo folder:
|
|
Insert the text below:
|
|
And the yum source is added.
Install Hugo
|
|
And Hugo is installed.
Create a site
To create a site with Hugo, run the command:
|
|
And you’ve got your site initialized.
Add a theme
The theme I use is hugo-paper, a clean theme to show code, and it supports dark mode.
# enter site directory
cd <path/to/mysite>
# download theme to the theme directory
git clone https://github.com/nanxiaobei/hugo-paper.git themes/paper
Modify the configuration, the config file is in the directory of the site, which calls config.toml.
|
|
And you can also copy the config file from theme directory, and modify it according to your requirements.
Pay attention to the baseURL in the config file, set it with the URL of your site.
Add posts
Add posts to your site.
|
|
And we have created a post. The — in the beginning is the information of the post which won’t be shown in your page. Your post can be added after the last —.
Build
You can generate static website after modifying the files properly.
|
|
And we’ll get the static website, the generated files are in the public directory.
Deploy pages
I use nginx as the program to deploy the static web pages. Modify the nginx configuration file:
|
|
Modify the user nginx to user root.
Modify the default.conf of nginx:
|
|
Reload nginx:
|
|
Congratulations! You’ve set up with your blog now, enjoy it.