Depoly this website to GitHub page by Hugo

Prequiments

  • Hugo
  • Git
  • GitHub
brew install git
brew install hugo

Create new site by Hugo

hugo new site wsgggws.github.io
cd wsgggws.github.io

git config --global init.defaultBranch main
git init

Install theme PaperMod

git submodule add --depth=1 https://github.com/adityatelange/hugo-PaperMod.git themes/PaperMod
git submodule update --init --recursive # needed when you reclone your repo (submodules may not get cloned automatically)

Edit config.yaml

Noted I set profileMode as true

# you could remove config.toml, or translate yaml to toml online
vim config.yaml

Make some dirctions named blogs, projects, about in content direction.

content
├── about
│   └── index.md
├── blogs
│   ├── go-solo.md
│   └── how-to-build-this-website.md
├── projects
│   ├── learn-english.md
│   └── learn-go.md
└── tags

Create a new posts

hugo new posts blogs/go-solo.md

Edit this file, and notice that set aliases: ["/blogs"] In this way, Its content could be showed in Blogs. Template could refer page.md

Observing locally website

hugo server

Hosting on GitHub

Create a repo named {username}.github.io in GitHub

# You should change wsgggws to your username
git remote add origin git@github.com:wsgggws/wsgggws.github.io.git

vim .github/workflows/hugo.yaml

git add .
git commit -m"Add github action for auto deploying"
git push -f -u origin main

# After GitHub action is done
open https://wsgggws.github.io

Write blogs and auto deploy

hugo new posts blogs/xxx.md
vim conten/blogs/xxx.md
git add .
git commit -m"Add a new post xxx"
git push -f origin main

# After GitHub action is done
open https://wsgggws.github.io