2022.12.10 - Install Hugo#
To install Hugo:
$ sudo apt update
$ sudo apt upgrade -y
$ sudo apt install hugo
2022.12.11 - Setup Hugo#
To setup blog site with Hugo locally:
$ mkdir -p source/github
$ cd source/github
$ git clone https://github.com/<user>/<user>.github.io.git
$ cd <user>.github.io
$ git checkout -b setup-hugo
Switched to a new branch 'setup-hugo'
$
$ hugo new site --force .
$ git clone https://github.com/panr/hugo-theme-terminal.git themes/terminal
$ vi config.toml
<hugo_home>/config.toml:
theme = 'terminal'
baseURL = '/'
enableEmoji = true
For the rest of the setup, please refer to hugo-theme-terminal
To start the Hugo server:
$ hugo server -t terminal --bind=0.0.0.0
To push blog to GitHub:
$ git add .
$ git status
$ git commit -m "setup 1 of blog site"
$ git push origin setup-hugo
$
$ git checkout main
$ git pull
$
To automating website deployment with CD process, and the please refer cd.yml
to 04-continous-deployment:
$ git checkout -b add-cd
Switched to a new branch 'add-cd'
$
$ mkdir -p .github/workflows
$ touch .github/workflows/cd.yml
$ vi .github/workflows/cd.yml
$
$
$ git add .github/workflows/cd.yml
$ git commit -m "Add a GitHub Actions workflow to build and deploy the site"
$ git push origin add-cd
$ git checkout main
Switched to branch 'main'
Your branch is up to date with 'origin/main'.
$ git pull
$
Setup GH-Pages#
Before pushing to GitHub, below is the additional setup for SSH logiin to GH. See Set up GitHub push with SSH keys.md
$ git remote set-url origin git@github.com:username/your-repository.git
In case of CD process fails, add extended: true
next to hugo-version: 'latest'
In case of action-gh-pages
fails, such as Action failed with “The process ‘/usr/bin/git’ failed with exit code 128”
- change settings under
Settings-Action-General
- Workflow Permissions: Read and Write
- Allow GitHub Actions to approve pull requests
2022.12.12 - Configure Hugo#
To check out a new branch to add content:
$ git checkout -b adding-content
$
For example, to create site content inside content
directory:
$ hugo new posts/<title>.md
$
$ vim content/posts/<title>.md
$
To push to GitHub and merging to main
$ git add .
$ git commit -m "yyyy.mm.dd - adding new post"
$ git push origin adding-content
$
$ git checkout main
$ git pull
$
2023.04.30 - Reference#
Here is a reference to tutorial on blogging with Hugo and GitHub Pages.
2023.07.19 - Upgrade#
I decided to upgrade the Hugo with Package Managers (snap) in order to stay with latest version (easier).
- See the instruction at Linux Installation
2023.10.05 - Update#
- Check if “Read and write permissions” are enabled in Settings -> Actions -> General -> Workflow permissions:
- Make sure it is “Read and write permission”
- Check the option “Allow GitHub Actions to create and approve pull requests”