1. Hugo installation

# Using hugo on Rocky Linux
# download latest hugo from github release (dnf can not find the .pem file)
wget https://github.com/gohugoio/hugo/releases/download/v0.146.7/hugo_extended_0.146.7_linux-amd64.tar.gz
tar -xvzf hugo_extended_0.146.7_linux-amd64.tar.gz
sudo mv hugo /usr/local/bin/
# check
hugo version

2. Create a new Hugo project

hugo new site ${project_name}
cd ${project_name}

3. Install theme (PaperMod, manual download)

# or download latest release from github(code > download zip)
wget https://github.com/adityatelange/hugo-PaperMod/archive/refs/heads/master.zip
unzip master.zip
mv hugo-PaperMod-master themes/PaperMod

set theme in hugo.toml

baseURL = 'https://example.org/'
languageCode = 'zh-tw'
title = 'my blog'
theme = "PaperMod"

4. Create homepage, about me and posts

# homepage
hugo new _index.md
# about me
hugo new about.md
# normal post
hugo new posts/my-first-post.md
# trip post
hugo new travel-posts/first-trip.md

5. Modify frontmatter of post

---
title: "post no. 1"
date: 2025-01-01
# if set true then the post will not be published
draft: false
---

First Post!

6. Add post and categories on navbar

add post to navbar

[[menu.main]]
  name = "首頁"
  url = "/"
  weight = 1

[[menu.main]]
  name = "文章"
  url = "/posts/"
  weight = 2

add categories to navbar

# in post's frontmatter
---
title: "trip to Taiwan"
date: 2025-04-25
draft: false
categories: ["travel"]
---
[menu]
  [[menu.main]]
    name = "首頁"
    url = "/"
    weight = 1

  [[menu.main]]
    name = "文章"
    url = "/posts/"
    weight = 2

  [[menu.main]]
    name = "文章分類"
    url = "/categories/"
    weight = 3

7. Enable profile mode

[params]
  defaultTheme = "auto"
  ShowShareButtons = true
  ShowReadingTime = true
  ShowCodeCopyButtons = true

[params.homeInfoParams]
  Title = "Hi 👋"
  Content = "歡迎來到我的 Hugo 個人部落格"

[params.profileMode]
  enabled = true
  title = "Hi 👋"
  subtitle = "歡迎來到我的部落格"
  imageUrl = "images/avatar.png"
  imageTitle = "我的頭像"
  buttons = [
    { name = "文章", url = "/posts/" },
    { name = "關於我", url = "/about/" }
  ]

8. Run hugo server

# D for includes drafts
hugo server -D

9. Notes

  • Don’t move .md file manually, will cause routing error. If you want to move, please use hugo new to create and paste content.
  • hugo list all to check all routes