Back to Hugo in 2024

1. Theme

Hermit-V2

Hermit-V2 is a minimal and fast theme for Hugo, built for bloggers who want a simple and focused website. This is a maintained fork of Hermit, which iterates over the original work to have a almost-stable experience with bug fixes and new features.

run git submodule add -b main https://github.com/1bl4z3r/hermit-V2 themes/hermit-v2

# .gitmodules

[submodule "themes/hermit-v2"]
	path = themes/hermit-v2
	url = https://github.com/1bl4z3r/hermit-V2
	branch = main

Once it’s added, run

git submodule init
git submodule update

or
git submodule update --init

Alternatively, run when git clone the djfan-me-blog repository

git clone --recurse-submodules --remote-submodules <repo-URL>

2. Error: assets/scss

ERROR EXECUTE-AS-TEMPLATE: failed to transform “scss/style.scss” (text/x-scss): template: scss/style.scss:9:14: executing “scss/style.scss” at <readDir “assets/scss”>: error calling readDir: failed to read directory “assets/scss”: open …/assets/scss: no such file or directory

Add empty folder assets/scss to repo1 (djfan-me-blog) repo to fix the error above.

Change the title to djfan. And change the footer and header to fit the minimalism style

4. Draft, Future, and Expired Content

https://gohugo.io/getting-started/usage/#draft-future-and-expired-content

By default, Hugo will not publish content when:

  • The draft value is true
  • The date is in the future
  • The publishDate is in the future
  • The expiryDate is in the past

run hugo or hugo server with command line flags:

hugo --buildDrafts    # or -D
hugo --buildExpired   # or -E
hugo --buildFuture    # or -F

5. New Post, then Publish it

First

hugo new posts/{6-digit yearmonth}/{post name}.md

Then, finish writing the post. Preview the post before changing the draft statue to false.

Next

# publish -> ./public folder is updated and overwritten
hugo  

# push the published contents to repo2
# repo2: djfan-me/djfan-me.github.io
cd public
git add .
git commit -m 'xxxx'
git push

Next task is to automate this process using e.g. Github Action.