Configuration
根目录包含 6 个 JSON 配置文件,由 g-blog Core 合并并校验;site.json 和 build.json 必需。
The repository root contains six JSON configuration files merged and validated by g-blog Core; site.json and build.json are required.
Site settings
| 字段 Field |
必填 Required |
含义 Description |
默认或约束 Default or constraint |
|---|---|---|---|
title |
是 Yes |
站点标题 Site title |
缺失即报错 Errors if missing |
description |
否 No |
站点描述和 SEO 回退 Site description and SEO fallback |
空字符串 Empty string |
author |
否 No |
作者名 Author name |
空字符串 Empty string |
url |
启用 Feed 时 When Feed is enabled |
站点绝对地址,用于 canonical、Feed 等 Absolute site URL for canonical links, feeds, and more |
启用 Feed 时为空即报错 Errors if Feed is enabled and empty |
language |
否 No |
HTML 的 lang 属性HTML lang attribute |
zh-CN |
Build and pagination
| 字段 Field |
必填 Required |
含义 Description |
默认 Default |
|---|---|---|---|
publishedLabel |
是 Yes |
Issue 发布标签 Issue publication label |
无 None |
metaMarker |
是 Yes |
正文 meta 注释块标记 Body meta-comment marker |
无 None |
pageLabel |
是 Yes |
独立页标签 Standalone-page label |
无 None |
dirPrefix |
是 Yes |
目录标签前缀,例如 dir:essaysDirectory-label prefix, such as dir:essays |
无 None |
postDir |
否 No |
文章输出目录 Post output directory |
post |
contentDir |
否 No |
本地 Markdown 内容目录 Local Markdown content directory |
content |
excludedLabels |
否 No |
额外排除的标签 Additional excluded labels |
[] |
Pagination
home、archive、directory 和 tag 分别设置对应页面的每页条数,值必须是正整数。
home, archive, directory, and tag set the page size for each view and must be positive integers.
Appearance
| 字段 Field |
含义 Description |
默认 Default |
|---|---|---|
theme.name |
主题目录名 themes/<name>Theme directory name themes/<name> |
default |
theme.skin |
皮肤文件名,不含 .cssSkin filename without .css |
空字符串,使用主题默认值 Empty; uses the theme default |
logo.type |
text 或 image |
text |
logo.value |
Logo 文本或图片 URL Logo text or image URL |
站点标题 Site title |
links[] |
导航外链,包含 label 和 hrefNavigation links with label and href |
[] |
footer.* |
版权、ICP 与公安备案信息 Copyright, ICP, and public-security registration |
空 Empty |
主题开发与深度定制见主题指南。
See the Theme Guide for theme development and deeper customization.
Content features
| 字段 Field |
含义 Description |
默认 Default |
|---|---|---|
toc |
目录及显示阈值 Table of contents and display thresholds |
开 / 2 / 5 On / 2 / 5 |
readingTime |
阅读时长及中英文速度 Reading time and Chinese/English rates |
开 / 400 / 250 On / 400 / 250 |
summary |
摘要长度 Summary length |
开 / 120 On / 120 |
cover |
列表卡片首图 First-image list thumbnail |
开 On |
math |
KaTeX 数学公式 KaTeX math |
开 On |
codeCopy |
代码复制按钮 Code-copy button |
开 On |
imageZoom |
图片灯箱 Image lightbox |
开 On |
share |
分享开关与平台白名单 Sharing and network allowlist |
开 / copy,x,telegram,weibo On / copy,x,telegram,weibo |
widgets |
回顶部、回首页、阅读进度 Back to top, back home, reading progress |
开 On |
og |
OG 和社交卡片 OG and social cards |
开 On |
canonical |
canonical 链接 Canonical link |
开 On |
jsonLd |
JSON-LD 结构化数据 JSON-LD structured data |
开 On |
webp |
WebP 转码及质量 WebP conversion and quality |
开 / 80 On / 80 |
errorPages.codes |
生成的错误页状态码 Generated error-page status codes |
[404,403,500] |
Feeds
| 字段 Field |
含义 Description |
约束 Constraint |
|---|---|---|
enabled |
是否生成 Feed Whether to generate feeds |
Boolean |
formats |
输出格式 Output formats |
启用时须为 rss / atom / json 的非空子集When enabled, a non-empty subset of rss / atom / json |
count |
收录最新文章数 Number of latest posts |
正整数 Positive integer |
summaryLength |
摘要长度;0 表示全文Summary length; 0 means full text |
大于等于 0 的整数 Integer greater than or equal to 0 |
启用 Feed 时,site.url 必填。
site.url is required when Feed is enabled.
Comments
| 字段 Field |
含义 Description |
|---|---|
enabled |
是否启用 giscus Whether to enable giscus |
repo |
评论仓 owner/repoComment repository owner/repo |
repoId |
giscus 仓库 ID giscus repository ID |
category |
Discussion 分类名 Discussion category name |
categoryId |
Discussion 分类 ID Discussion category ID |
mapping |
映射方式,默认 pathnameMapping method; defaults to pathname |
repoId 和 categoryId 由 giscus.app 生成,是公开值,不是 Secret。
repoId and categoryId are generated by giscus.app; they are public values, not Secrets.