本文档详细介绍 jijian 主题的所有配置参数,包含站点级配置和文章级配置。
站点级配置
在站点根目录的 hugo.yaml 文件中配置以下参数:
基础配置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
baseURL: https://your-domain.com/ # 站点 URL
title: 站点标题 # 站点名称
copyright: 版权信息 # 页脚版权文字
theme: jijian # 主题名称
defaultContentLanguage: zh-cn # 默认语言(决定 HTML lang 属性,防止浏览器询问是否翻译)
languageCode: zh-cn # 语言代码(对应 i18n/zh-cn.yaml 翻译文件)
timeZone: "Asia/Shanghai" # 时区
enableRobotsTXT: true # 生成 robots.txt
cleanDestinationDir: true # 构建前清理目标目录
buildDrafts: false # 是否构建草稿
buildFuture: false # 是否构建未来日期的文章
buildExpired: false # 是否构建已过期的文章
|
params 配置块
所有主题特定的参数都配置在 params 块中:
站点信息
1
2
3
4
5
|
params:
env: production # 环境:production / development
description: "站点描述" # 用于 SEO 的站点描述
keywords: ["关键词1", "关键词2"] # 站点关键词
author: 作者名 # 作者名称
|
首页模式
主题提供三种首页模式,详见 首页模式
文档:
Blog Mode(博客模式)
默认模式,通过 mainSections 指定首页显示的内容分区:
1
2
3
4
|
params:
mainSections:
- posts
- docs
|
Portal Mode(门户模式)
1
2
3
4
5
6
|
params:
portalMode:
enabled: true # 启用门户模式
Title: 你的名字 # 标题
Content: 欢迎来到我的小站... # 内容描述
AlignSocialIconsTo: center # 社交图标对齐:left / center / right
|
Card Mode(名片模式)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
params:
cardMode:
enabled: true # 启用名片模式
title: 你的名字 # 主标题
subtitle: 欢迎来到我的小站 # 副标题
imageUrl: /img/avatar.png # 头像图片路径
imageWidth: 120 # 图片宽度(像素)
imageHeight: 120 # 图片高度(像素)
imageTitle: 头像 # 图片标题(alt 属性)
buttons: # 可选按钮
- name: 文章
url: posts
- name: 关于
url: about
|
显示控制
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
params:
# 阅读相关
ShowReadingTime: true # 显示阅读时长
ShowWordCount: true # 显示字数统计
readingSpeed: 200 # 阅读速度(字/分钟)
# 导航与交互
ShowPostNavLinks: true # 显示上下篇导航
ShowBreadCrumbs: true # 显示面包屑导航
ShowCodeCopyButtons: true # 显示代码复制按钮
ShowRssButtonInSectionTermList: true # 在列表页显示 RSS 按钮
ShowPageNums: true # 分页显示页码
# 分享
ShowShareButtons: true # 显示分享按钮
ShareButtons: # 分享按钮列表
- x # Twitter/X
- linkedin
- reddit
- facebook
- whatsapp
- telegram
- ycombinator
|
目录配置
1
2
3
4
5
6
7
8
|
params:
ShowToc: true # 显示目录(默认 true,不配置也会显示)
TocOpen: true # 目录默认展开(默认 true,不配置也会展开)
TocPosition: auto # 目录位置:left / right / auto
tocHover: false # 启用目录悬浮模式
tocHoverDelay: 200 # 目录悬浮延迟(毫秒)
tocHideDelay: 2000 # 目录隐藏延迟(毫秒)
UseHugoToc: false # 使用 Hugo 原生目录
|
说明:
ShowToc 和 TocOpen 默认值均为 true,即使不配置也会显示并展开目录
- 如需隐藏目录,可设置
ShowToc: false
- 如需目录默认折叠,可设置
TocOpen: false
TocPosition:
left:目录固定在左侧
right:目录固定在右侧
auto:根据屏幕宽度自动选择
tocHover:启用后,鼠标悬停时才显示目录,点击后保持显示
主题与样式
1
2
3
4
5
6
7
8
|
params:
defaultTheme: auto # 默认主题:light / dark / auto
disableThemeToggle: false # 禁用主题切换按钮
disableLangToggle: false # 禁用语言切换按钮
disableScrollToTop: false # 禁用返回顶部按钮
disableSpecial1stPost: false # 禁用首篇特殊样式
displayFullLangName: true # 显示完整语言名称
DateFormat: ":date_long" # 日期格式
|
日期格式示例:
1
2
3
4
5
6
7
|
# Hugo 预定义格式
DateFormat: ":date_long" # 2024年1月1日
DateFormat: ":date_full" # 2024年1月1日 星期一
# 自定义格式(Go 时间格式)
DateFormat: 2006年01月02日 # 2024年01月01日
DateFormat: 2006-01-02 15:04:05 # 2024-01-01 10:30:00
|
资源配置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
params:
assets:
# Favicon
favicon: /img/favicon.ico
favicon16x16: /img/favicon-16x16.png
favicon32x32: /img/favicon-32x32.png
apple_touch_icon: /img/apple-touch-icon.png
safari_pinned_tab: /img/safari-pinned-tab.svg
# 主题色
theme_color: "#2e2e33" # 移动端浏览器地址栏颜色
msapplication_TileColor: "#2e2e33" # Windows 磁贴颜色
# 代码高亮
chromaStyle: catppuccin-macchiato # 代码高亮样式
# 其他
disableFingerprinting: false # 禁用资源指纹
disableScrollBarStyle: false # 禁用自定义滚动条样式
|
代码高亮样式列表:
| 样式名称 |
说明 |
catppuccin-macchiato |
默认样式 |
catppuccin-mocha |
Catppuccin 深色 |
catppuccin-frappe |
Catppuccin 中等深度 |
catppuccin-latte |
Catppuccin 浅色 |
github |
GitHub 浅色 |
github-dark |
GitHub 深色 |
monokai |
经典 Monokai |
dracula |
Dracula 主题 |
nord |
Nord 极光 |
tokyonight-night |
Tokyo Night |
gruvbox |
Gruvbox 复古 |
onedark |
Atom OneDark |
solarized-dark |
Solarized 深色 |
封面配置
1
2
3
4
|
params:
cover:
linkFullImages: true # 封面图片可点击放大
responsiveImages: true # 生成响应式图片
|
社交图标
1
2
3
4
5
6
7
8
9
10
11
|
params:
socialIcons:
- name: bilibili
url: https://space.bilibili.com/xxxxxx #可选
title: 哔哩哔哩 # 可选,鼠标悬停显示的文字
hoverImage: /img/qr-bilibili.png # 可选,悬浮图片/二维码
- name: wechat
url: "javascript:void(0);" # 无跳转链接,当然也可以不配置这一项
hoverImage: /img/wechat-qr.png
- name: github
url: https://github.com/yourname
|
支持的平台:
国内平台:bilibili、douyin、xiaohongshu、shipinhao(视频号)、zhihu、douban、weibo、wechat
国际平台:github、twitter/x、linkedin、youtube、instagram、facebook、email
悬浮二维码功能:配置 hoverImage 参数后,鼠标悬停在图标上会弹出图片/二维码。
页脚配置
1
2
3
4
|
params:
footer:
hideCopyright: false # 隐藏版权信息
text: "自定义页脚文字" # 自定义页脚内容(支持 HTML)
|
评论系统
主题支持 Giscus 评论系统,详见 功能配置
文档:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
params:
comments: true # 启用评论
giscus:
repo: "user/repo" # GitHub 仓库(格式:用户名/仓库名)
repoId: "R_xxxxx" # 仓库 ID(从 giscus.app 获取)
category: "Announcements" # Discussion 分类
categoryId: "DIC_xxxxx" # 分类 ID(从 giscus.app 获取)
mapping: pathname # 映射方式
reactionsEnabled: 1 # 启用反应
emitMetadata: 0 # 发送元数据
inputPosition: top # 输入框位置:top / bottom
theme: preferred_color_scheme # 主题
lang: zh-CN # 语言
|
编辑文章链接
1
2
3
4
5
6
|
params:
editPost:
URL: "https://github.com/user/repo/tree/main/content"
Text: "编辑" # 按钮文字
appendFilePath: true # 追加文件路径
disabled: false # 禁用编辑按钮
|
SEO 分析
1
2
3
4
5
6
7
8
9
10
|
params:
analytics:
google:
SiteVerificationTag: "xxxxx" # Google Search Console 验证
yandex:
SiteVerificationTag: "xxxxx" # Yandex 验证
bing:
SiteVerificationTag: "xxxxx" # Bing 验证
naver:
SiteVerificationTag: "xxxxx" # Naver 验证
|
Logo 配置
1
2
3
4
5
|
params:
label:
text: 站点名称 # Logo 文字
icon: /img/logo.svg # Logo 图标
iconHeight: 32 # 图标高度
|
文章级配置
在文章的 Front Matter 中可以覆盖站点级配置:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
---
title: "文章标题"
date: 2024-01-01
draft: false
description: "文章描述"
keywords: ["关键词1", "关键词2"]
tags: ["标签1", "标签2"]
categories: ["分类"]
series: ["系列"]
# 封面配置
cover:
image: /images/cover.jpg
alt: 封面描述
caption: 封面说明
relative: false # 是否相对路径
responsiveImages: true # 生成响应式图片
# 显示控制(覆盖站点配置)
hideMeta: false # 隐藏元信息
hideSummary: false # 隐藏摘要
hideFooter: false # 隐藏页脚
ShowReadingTime: true # 显示阅读时长
ShowWordCount: true # 显示字数统计
ShowToc: true # 显示目录(默认 true,不配置也会显示)
TocOpen: true # 目录默认展开(默认 true,不配置也会展开)
TocPosition: left # 目录位置
tocHover: false # 目录悬浮模式
comments: true # 启用评论
disableShare: false # 禁用分享按钮
hiddenInHomeList: false # 在首页列表隐藏
# SEO
canonicalURL: "" # 规范链接
robotsNoIndex: false # 不索引此页面
# 编辑链接
editPost:
disabled: false # 禁用编辑按钮
---
|
完整配置示例
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
baseURL: https://your-domain.com/
title: 我的博客
copyright: © 2024 我的博客
theme: jijian
defaultContentLanguage: zh-cn
languageCode: zh-cn
timeZone: "Asia/Shanghai"
enableRobotsTXT: true
cleanDestinationDir: true
menu:
main:
- identifier: posts
name: 文章
url: /posts/
weight: 10
- identifier: archives
name: 归档
url: /archives/
weight: 11
parent: posts
- identifier: categories
name: 分类
url: /categories/
weight: 12
parent: posts
- identifier: tags
name: 标签
url: /tags/
weight: 13
parent: posts
- identifier: search
name: 搜索
url: /search/
weight: 20
- identifier: about
name: 关于
url: /about/
weight: 30
params:
env: production
description: "我的个人博客"
keywords: ["博客", "技术", "分享"]
author: 你的名字
cardMode:
enabled: true
title: 你的名字
subtitle: 👋 Hello! 欢迎来到我的小站
imageUrl: /img/avatar.png
imageWidth: 120
imageHeight: 120
ShowReadingTime: true
ShowWordCount: true
readingSpeed: 200
ShowShareButtons: true
ShowPostNavLinks: true
ShowBreadCrumbs: true
ShowCodeCopyButtons: true
ShowToc: true
TocOpen: true
TocPosition: auto
defaultTheme: auto
DateFormat: 2006年01月02日
assets:
favicon: /img/favicon.ico
chromaStyle: catppuccin-macchiato
socialIcons:
- name: bilibili
url: https://space.bilibili.com/xxxxxx
- name: github
url: https://github.com/yourname
comments: false
outputs:
home:
- HTML
- RSS
markup:
highlight:
noClasses: false
lineNos: true
|