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

  1. 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.

  2. Go to the blog builder directory, git init

  3. 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
  4. Then, add the theme to the site configuration: echo ‘theme = “XXX “‘ >> config.toml XXX is the name of the theme directory

  5. Create a new post: Hugo new posts/first_post.md

    D:\blog\xxx.github.io-generator\content\posts\first_post.md created

  6. After editing the article, change Draft: False. Draft: true means it is in draft state, at which point Hugo will not actually release it

  7. 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 /

  8. 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 themhugo --help
  9. Executing Hugo creates a new directory, public/, that needs to be submitted to Github and eventually generated online

  10. In the root directory, create a.gitignore file and add /public/. Make /public a repository of its own

  11. Go to public CD public, git init git add. git commit

First Deployment

  1. Log in to Github and create a blog repository. The repository name must be [username].github.
  2. Go to the public directory and go to git remote add origin XXX
  3. git push -u origin master
  4. Go to Github Repository Settings, go to Github Pages, select Master, and save
  5. To access the blog, visit http://[username].github. IO

Future deployment

  1. Execute in xxx.github. IO – Creator (make sure you are not in the public directory)Hugo New posts/ second blog. Md
  2. performCode posts/ second blog. MdEdit the blog content, be careful not to delete the front matter section.
  3. Hugo Server -D set up a local visit to https://localhost:1313 preview blog
  4. Run Hugo -d to get the new public directory
  5. Go to the public directorycd publicTo perform the following operations
    1. Git add.
    2. git commit -m update
    3. Git push -f
  6. 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