refactor: use TOML for configuration file (#1228)

* refactor: remove jsconfig.json

* chore: remove devcontainer config

* refactor: migrate Hugo configuration from `hugo.yaml` to dedicated `module.toml` and `params.toml` files, and update minimum Hugo version.

* refactor: migrate demo site configuration from `hugo.yaml` to `config/_default/*.toml`

* feat: enable local sidebar avatar for demo site and relocate its image to demo assets.

* feat: migrate demo site to Hugo Modules for theme management.

* fix: wrong config folder name
This commit is contained in:
Jimmy
2026-01-25 19:51:10 +01:00
committed by GitHub
parent ffab83a637
commit 406fcef7cd
16 changed files with 298 additions and 560 deletions
-56
View File
@@ -1,56 +0,0 @@
# syntax=docker/dockerfile:1
FROM mcr.microsoft.com/devcontainers/base:ubuntu-22.04
ARG USER=vscode
ARG DEBIAN_FRONTEND=noninteractive
RUN usermod -s /usr/bin/zsh ${USER}
# VARIANT can be either 'hugo' for the standard version or 'hugo_extended' for the extended version.
ARG VARIANT=hugo_extended
# VERSION can be either 'latest' or a specific version number
ARG VERSION=latest
# Download Hugo
RUN case ${VERSION} in \
latest) \
export VERSION=$(curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4)}') ;;\
esac && \
echo ${VERSION} && \
case $(uname -m) in \
aarch64) \
export ARCH=ARM64 ;; \
*) \
export ARCH=64bit ;; \
esac && \
echo ${ARCH} && \
wget -O ${VERSION}.tar.gz https://github.com/gohugoio/hugo/releases/download/v${VERSION}/${VARIANT}_${VERSION}_Linux-${ARCH}.tar.gz && \
tar xf ${VERSION}.tar.gz && \
mv hugo /usr/bin/hugo
# Hugo dev server port
EXPOSE 1313
USER ${USER}
ARG HOME=/home/${USER}
WORKDIR ${HOME}
ARG PNPM_HOME=${HOME}/.local/share/pnpm
ENV PATH="${PNPM_HOME}:$PATH"
RUN <<EOT
wget -qO- https://get.pnpm.io/install.sh | ENV="${HOME}/.zshrc" SHELL=/bin/zsh sh -
pnpm env use -g lts
EOT
ARG OHMYZSH_HOME=${HOME}/.oh-my-zsh
# ARG OHMYZSH_THEME=${OHMYZSH_HOME}/custom/themes
# RUN <<EOT
# git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${OHMYZSH_THEME}/powerlevel10k
# sed -i 's|ZSH_THEME="devcontainers"|ZSH_THEME="powerlevel10k/powerlevel10k"|g' .zshrc
# echo 'POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true' >> .zshrc
# EOT
RUN <<EOT
hugo completion zsh > ${OHMYZSH_HOME}/plugins/git/_hugo
EOT
-51
View File
@@ -1,51 +0,0 @@
{
"name": "Hugo & pnpm",
"build": {
"dockerfile": "Dockerfile"
},
// 👇 Features to add to the Dev Container. More info: https://containers.dev/implementors/features.
// "features": { "ghcr.io/devcontainers/features/docker-in-docker:2": {} },
// 👇 Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"html.format.templating": true
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
// https://marketplace.visualstudio.com/items?itemName=eliostruyf.vscode-front-matter
"eliostruyf.vscode-front-matter",
// https://marketplace.visualstudio.com/items?itemName=rusnasonov.vscode-hugo
"rusnasonov.vscode-hugo",
// https://marketplace.visualstudio.com/items?itemName=budparr.language-hugo-vscode
"budparr.language-hugo-vscode",
// https://marketplace.visualstudio.com/items?itemName=eliostruyf.vscode-hugo-themer
"eliostruyf.vscode-hugo-themer",
// https://marketplace.visualstudio.com/items?itemName=kaellarkin.hugo-shortcode-syntax
"kaellarkin.hugo-shortcode-syntax",
// "csstools.postcss",
// "esbenp.prettier-vscode",
// "tamasfe.even-better-toml",
// "naumovs.color-highlight",
// "GitHub.vscode-pull-request-github",
// "eamodio.gitlens",
"davidanson.vscode-markdownlint",
"streetsidesoftware.code-spell-checker"
]
}
},
"remoteUser": "vscode",
"postCreateCommand": "pnpm install-completion zsh"
}
-12
View File
@@ -1,12 +0,0 @@
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"*": [
"*"
]
},
"lib": ["es2020", "dom"],
"jsx": "preserve"
}
}
+3
View File
@@ -0,0 +1,3 @@
[hugoVersion]
extended = true
min = "0.154.0"
+138
View File
@@ -0,0 +1,138 @@
mainSections = ["post"]
featuredImageField = "image"
rssFullContent = true
[footer]
since = 2026
customText = ""
[dateFormat]
published = "Jan 02, 2006"
lastUpdated = "Jan 02, 2006 15:04 MST"
[sidebar]
compact = false
[sidebar.avatar]
enabled = false
local = true
src = "img/avatar.png"
[article]
headingAnchor = false
math = false
toc = true
readingTime = true
[article.license]
enabled = false
default = "Licensed under CC BY-NC-SA 4.0"
[widgets]
homepage = []
page = []
[opengraph.twitter]
site = ""
card = "summary_large_image"
[defaultImage.opengraph]
enabled = false
local = false
[colorScheme]
toggle = true
default = "auto"
[imageProcessing.cover]
enabled = true
[imageProcessing.content]
enabled = true
[comments]
enabled = true
provider = "disqus"
[comments.disqusjs]
shortname = ""
apiUrl = ""
apiKey = ""
admin = ""
adminLabel = ""
[comments.utterances]
repo = ""
issueTerm = "pathname"
label = ""
[comments.beaudar]
repo = ""
issueTerm = "pathname"
label = ""
theme = ""
[comments.remark42]
host = ""
site = ""
locale = ""
[comments.vssue]
platform = ""
owner = ""
repo = ""
clientId = ""
clientSecret = ""
autoCreateIssue = false
# Waline client configuration see: https://waline.js.org/en/reference/component.html
[comments.waline]
serverURL = ""
lang = ""
pageview = ""
emoji = [
"https://unpkg.com/@waline/emojis@1.0.1/weibo"
]
requiredMeta = [
"name",
"email",
"url"
]
[comments.waline.locale]
admin = "Admin"
placeholder = ""
[comments.twikoo]
envId = ""
region = ""
path = ""
lang = ""
# See https://cactus.chat/docs/reference/web-client/#configuration for description of the various options
[comments.cactus]
defaultHomeserverUrl = "https://matrix.cactus.chat:8448"
serverName = "cactus.chat"
siteName = "" # You must insert a unique identifier here matching the one you registered (See https://cactus.chat/docs/getting-started/quick-start/#register-your-site)
[comments.giscus]
repo = ""
repoID = ""
category = ""
categoryID = ""
mapping = ""
lightTheme = ""
darkTheme = ""
reactionsEnabled = 1
emitMetadata = 0
[comments.gitalk]
owner = ""
admin = ""
repo = ""
clientID = ""
clientSecret = ""
proxy = ""
[comments.cusdis]
host = ""
id = ""

Before

Width:  |  Height:  |  Size: 373 B

After

Width:  |  Height:  |  Size: 373 B

+26
View File
@@ -0,0 +1,26 @@
baseURL = "https://example.com/"
languageCode = "en-us"
title = "Example Site"
copyright = "Example Person"
# Theme i18n support
# Available values: ar, bn, ca, de, el, en, es, fr, hu, id, it, ja, ko, nl, pt-br, th, uk, zh-cn, zh-hk, zh-tw
defaultContentLanguage = "en"
# Set hasCJKLanguage to true if DefaultContentLanguage is in [zh-cn ja ko]
# This will make .Summary and .WordCount behave correctly for CJK languages.
hasCJKLanguage = false
[[module.imports]]
path = "github.com/CaiJimmy/hugo-theme-stack/v3"
[pagination]
pagerSize = 3
[permalinks]
post = "/p/:slug/"
page = "/:slug/"
[services.disqus]
shortname = "hugo-theme-stack"
+35
View File
@@ -0,0 +1,35 @@
[en]
languageName = "English"
title = "Example Site"
weight = 1
[en.params.sidebar]
subtitle = "Example description"
[zh-cn]
languageName = "简体中文"
title = "演示站点"
weight = 2
[zh-cn.params.sidebar]
subtitle = "演示说明"
[zh-tw]
languageName = "正體中文"
title = "演示站點"
weight = 2
[zh-tw.params.sidebar]
subtitle = "演示說明"
[ja]
languageName = "日本語"
title = "サンプルサイト"
weight = 2
[ja.params.sidebar]
subtitle = "サンプル説明"
[ar]
languageName = "عربي"
languagedirection = "rtl"
title = "موقع تجريبي"
weight = 3
[ar.params.sidebar]
subtitle = "وصف تجريبي"
+24
View File
@@ -0,0 +1,24 @@
[goldmark]
[goldmark.extensions]
[goldmark.extensions.passthrough]
enable = true
[goldmark.extensions.passthrough.delimiters]
block = [["\\[", "\\]"], ["$$", "$$"]]
inline = [["\\(", "\\)"]]
[goldmark.renderer]
## Set to true if you have HTML content inside Markdown
unsafe = true
[tableOfContents]
endLevel = 4
ordered = true
startLevel = 2
[highlight]
noClasses = false
codeFences = true
guessSyntax = true
lineNoStart = 1
lineNos = true
lineNumbersInTable = true
tabWidth = 4
+13
View File
@@ -0,0 +1,13 @@
[[social]]
identifier = "github"
name = "GitHub"
url = "https://github.com/CaiJimmy/hugo-theme-stack"
[social.params]
icon = "brand-github"
[[social]]
identifier = "twitter"
name = "Twitter"
url = "https://twitter.com"
[social.params]
icon = "brand-twitter"
+37
View File
@@ -0,0 +1,37 @@
mainSections = ["post"]
rssFullContent = true
favicon = ""
[footer]
since = 2020
[dateFormat]
published = "Jan 02, 2006"
lastUpdated = "Jan 02, 2006 15:04 MST"
[sidebar]
emoji = "🍥"
subtitle = "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
[sidebar.avatar]
enabled = true
local = true
src = "img/avatar.png"
[article]
[article.license]
enabled = true
default = "Licensed under CC BY-NC-SA 4.0"
[widgets]
homepage = [
{ type = "search" },
{ type = "archives", params = { limit = 5 } },
{ type = "categories", params = { limit = 10 } },
{ type = "tag-cloud", params = { limit = 10 } },
]
page = [{ type = "toc" }]
[comments]
# See complete configuration in config/_default/params.toml
enabled = true
provider = "disqus"
+8
View File
@@ -0,0 +1,8 @@
includeNewer = true
threshold = 60
toLower = false
indices = [
{ name = "tags", weight = 100 },
{ name = "categories", weight = 200 },
]
+7
View File
@@ -0,0 +1,7 @@
module github.com/CaiJimmy/hugo-theme-stack/demo
go 1.25.6
replace github.com/CaiJimmy/hugo-theme-stack/v3 => ../
require github.com/CaiJimmy/hugo-theme-stack/v3 v3.34.0 // indirect
-285
View File
@@ -1,285 +0,0 @@
baseurl: https://example.com/
languageCode: en-us
theme: hugo-theme-stack
title: Example Site
copyright: Example Person
# Theme i18n support
# Available values: ar, bn, ca, de, el, en, es, fr, hu, id, it, ja, ko, nl, pt-br, th, uk, zh-cn, zh-hk, zh-tw
DefaultContentLanguage: en
# Set hasCJKLanguage to true if DefaultContentLanguage is in [zh-cn ja ko]
# This will make .Summary and .WordCount behave correctly for CJK languages.
hasCJKLanguage: false
languages:
en:
languageName: English
title: Example Site
weight: 1
params:
sidebar:
subtitle: Example description
zh-cn:
languageName: 简体中文
title: 演示站点
weight: 2
params:
sidebar:
subtitle: 演示说明
zh-tw:
languageName: 正體中文
title: 演示站點
weight: 2
params:
sidebar:
subtitle: 演示說明
ja:
languageName: 日本語
title: サンプルサイト
weight: 2
params:
sidebar:
subtitle: サンプル説明
ar:
languageName: عربي
languagedirection: rtl
title: موقع تجريبي
weight: 3
params:
sidebar:
subtitle: وصف تجريبي
services:
# Change it to your Disqus shortname before using
disqus:
shortname: "hugo-theme-stack"
# GA Tracking ID
googleAnalytics:
id:
pagination:
pagerSize: 3
permalinks:
post: /p/:slug/
page: /:slug/
params:
mainSections:
- post
featuredImageField: image
rssFullContent: true
favicon: # e.g.: favicon placed in `static/favicon.ico` of your site folder, then set this field to `/favicon.ico` (`/` is necessary)
footer:
since: 2020
customText:
dateFormat:
published: Jan 02, 2006
lastUpdated: Jan 02, 2006 15:04 MST
sidebar:
emoji: 🍥
subtitle: Lorem ipsum dolor sit amet, consectetur adipiscing elit.
avatar:
enabled: true
local: true
src: img/avatar.png
article:
math: false
toc: true
readingTime: true
license:
enabled: true
default: Licensed under CC BY-NC-SA 4.0
comments:
enabled: true
provider: disqus
disqusjs:
shortname:
apiUrl:
apiKey:
admin:
adminLabel:
utterances:
repo:
issueTerm: pathname
label:
beaudar:
repo:
issueTerm: pathname
label:
theme:
remark42:
host:
site:
locale:
vssue:
platform:
owner:
repo:
clientId:
clientSecret:
autoCreateIssue: false
# Waline client configuration see: https://waline.js.org/en/reference/component.html
waline:
serverURL:
lang:
pageview:
emoji:
- https://unpkg.com/@waline/emojis@1.0.1/weibo
requiredMeta:
- name
- email
- url
locale:
admin: Admin
placeholder:
twikoo:
envId:
region:
path:
lang:
# See https://cactus.chat/docs/reference/web-client/#configuration for description of the various options
cactus:
defaultHomeserverUrl: "https://matrix.cactus.chat:8448"
serverName: "cactus.chat"
siteName: "" # You must insert a unique identifier here matching the one you registered (See https://cactus.chat/docs/getting-started/quick-start/#register-your-site)
giscus:
repo:
repoID:
category:
categoryID:
mapping:
lightTheme:
darkTheme:
reactionsEnabled: 1
emitMetadata: 0
gitalk:
owner:
admin:
repo:
clientID:
clientSecret:
proxy:
cusdis:
host:
id:
widgets:
homepage:
- type: search
- type: archives
params:
limit: 5
- type: categories
params:
limit: 10
- type: tag-cloud
params:
limit: 10
page:
- type: toc
opengraph:
twitter:
# Your Twitter username
site:
# Available values: summary, summary_large_image
card: summary_large_image
defaultImage:
opengraph:
enabled: false
local: false
src:
colorScheme:
# Display toggle
toggle: true
# Available values: auto, light, dark
default: auto
imageProcessing:
cover:
enabled: true
content:
enabled: true
### Custom menu
### See https://stack.jimmycai.com/config/menu
### To remove about, archive and search page menu item, remove `menu` field from their FrontMatter
menu:
main: []
social:
- identifier: github
name: GitHub
url: https://github.com/CaiJimmy/hugo-theme-stack
params:
icon: brand-github
- identifier: twitter
name: Twitter
url: https://twitter.com
params:
icon: brand-twitter
related:
includeNewer: true
threshold: 60
toLower: false
indices:
- name: tags
weight: 100
- name: categories
weight: 200
markup:
goldmark:
extensions:
passthrough:
enable: true
delimiters:
block:
- - \[
- \]
- - $$
- $$
inline:
- - \(
- \)
renderer:
## Set to true if you have HTML content inside Markdown
unsafe: true
tableOfContents:
endLevel: 4
ordered: true
startLevel: 2
highlight:
noClasses: false
codeFences: true
guessSyntax: true
lineNoStart: 1
lineNos: true
lineNumbersInTable: true
tabWidth: 4
-149
View File
@@ -1,149 +0,0 @@
module:
hugoVersion:
extended: true
min: "0.87.0"
params:
mainSections:
- post
featuredImageField: image
rssFullContent: true
favicon:
footer:
since:
customText:
dateFormat:
published: Jan 02, 2006
lastUpdated: Jan 02, 2006 15:04 MST
sidebar:
compact: false
emoji:
subtitle:
avatar:
enabled: true
local: true
src: img/avatar.png
article:
headingAnchor: false
math: false
toc: true
readingTime: true
license:
enabled: false
default: Licensed under CC BY-NC-SA 4.0
comments:
enabled: false
provider: disqus
disqusjs:
shortname:
apiUrl:
apiKey:
admin:
adminLabel:
utterances:
repo:
issueTerm: pathname
label:
beaudar:
repo:
issueTerm: pathname
label:
theme:
remark42:
host:
site:
locale:
vssue:
platform:
owner:
repo:
clientId:
clientSecret:
autoCreateIssue: false
# Waline client configuration see: https://waline.js.org/en/reference/client/props.html
waline:
serverURL:
lang:
visitor:
avatar:
emoji:
- https://cdn.jsdelivr.net/gh/walinejs/emojis/weibo
requiredMeta:
- nick
- mail
locale:
admin: Admin
placeholder:
twikoo:
envId:
region:
path:
lang:
giscus:
repo:
repoID:
category:
categoryID:
mapping:
strict:
lightTheme:
darkTheme:
reactionsEnabled: 1
emitMetadata: 0
inputPosition:
lang:
gitalk:
owner:
admin:
repo:
clientID:
clientSecret:
cusdis:
host:
id:
widgets:
homepage: []
page: []
opengraph:
twitter:
# Your Twitter username
site:
# Available values: summary, summary_large_image
card: summary_large_image
defaultImage:
opengraph:
enabled: false
local: false
src:
colorScheme:
# Display toggle
toggle: true
# Available values: auto, light, dark
default: auto
imageProcessing:
cover:
enabled: true
content:
enabled: true
+3 -3
View File
@@ -20,8 +20,8 @@ features = [
"search",
]
min_version = "0.123.0"
min_version = "0.154.0"
[author]
name = "Jimmy Cai"
homepage = "https://jimmycai.com"
name = "Jimmy Cai"
homepage = "https://jimmycai.com"