The first official blog post, I want to share with you the creation process of my blog! ⭐ ️
Hugo is a static web site generator implemented by the Go language. Simple, easy to use, efficient, easy to expand, rapid deployment.
Install Hugo
-
Official Course English
-
Mac Installation mode
-
brew install hugo
-
hugo version
-
-
Windows Installation mode
- Go to the Hugo Releases page and download hugo_xxx_Windows-64bit. Zip
- Unzip and put hugo.exe in D:\Software\ Hugo \hugo.exe
- Add D:\Software\ Hugo \ to PATH
- Restart the terminal and run Hugo Version to check the version
Build a Blog quickly
Official documentation tutorial, must see!
Prepare, submit
-
Create a blog directory and run Hugo new site xxx.github. Iogenerator. XXX is the github user name. The xxx.github. IO -generator folder will be created in the current directory.
-
Go to the blog builder directory, git init
-
Select and download the theme, in the themes directory git clone https://github.com/xxx.git themes/XXX
-
Encountering error ↘
fatal: unable to access 'https://github.com/xxxxxx.git/': error setting certificate verify locations: CAfile: D:/Software/Git/mingw64/ssl/certs/ca-bundle.crt CApath: none Copy the code
-
Git clone fatal: Unable to access ‘https://github.com/… ‘, execute the code ↓
Git config --system http. sslVerify falseCopy the code
-
-
Then, add the theme to the site configuration: echo ‘theme = “XXX “‘ >> config.toml XXX is the name of the theme directory
-
Create a new post: Hugo new posts/first_post.md
D:\blog\xxx.github.io-generator\content\posts\first_post.md
created -
After editing the article, change Draft: False. Draft: true means it is in draft state, at which point Hugo will not actually release it
-
When creating a blog for the first time or changing a configuration topic, look into the topic documentation, which is usually written in the config.toml file.
BaseURL is set to http://[user name].github. IO /
-
Run the Hugo server -d command to set up a local access to https://localhost:1313 to preview the blog
- View more commands and execute them
hugo --help
- View more commands and execute them
-
Executing Hugo creates a new directory, public/, that needs to be submitted to Github and eventually generated online
-
In the root directory, create a.gitignore file and add /public/. Make /public a repository of its own
-
Go to public CD public, git init git add. git commit
First Deployment
- Log in to Github and create a blog repository. The repository name must be [username].github.
- Go to the public directory and go to git remote add origin XXX
git push -u origin master
- Go to Github Repository Settings, go to Github Pages, select Master, and save
- To access the blog, visit http://[username].github. IO
Future deployment
- Execute in xxx.github. IO – Creator (make sure you are not in the public directory)
Hugo New posts/ second blog. Md
- perform
Code posts/ second blog. Md
Edit the blog content, be careful not to delete the front matter section. - Hugo Server -D set up a local visit to https://localhost:1313 preview blog
- Run Hugo -d to get the new public directory
- Go to the public directory
cd public
To perform the following operations- Git add.
git commit -m update
- Git push -f
- Wait a few minutes and a second post will appear on your blog!
- The blog is still accessed through http://[username].github. IO
Backup blog Generator
Programmers always keep backups
-
Create a repository xxx.github. IO -generator
-
Git init, git add., git commit -m backup, git remote add origin XXX Git push -u origin master
- Git files already exist in the subject directory. The subject directory itself is a local repository and forms a nested subdirectory with the generator directory. That’s not good. We need to delete the.git file in the theme directory