仓库集成(编辑此页)¶
对应官方:Repository
配置仓库地址后,页眉会显示仓库链接;公开的 GitHub / GitLab 仓库还会显示 release tag、star 与 fork 数,并可启用"编辑此页 / 查看源码"按钮。
配置仓库¶
zensical.toml
[project]
repo_url = "https://github.com/yourname/yourrepo"
repo_name = "yourname/yourrepo"
| 配置项 | 说明 |
|---|---|
repo_url |
仓库公开 URL,显示在搜索栏旁 |
repo_name |
覆盖自动推断的显示名称 |
release / star / fork 显示
GitHub / GitLab 只提供"最新 release"API(不是 latest tag)。若要显示 tag,需在仓库中创建正式 release且不要标记为 pre-release。
编辑此页 / 查看源码¶
zensical.toml
[project.theme]
features = [
"content.action.edit", # 编辑此页
"content.action.view", # 查看源码
]
当 repo_url 指向 GitHub 仓库时,Zensical 会自动推导 view / edit URL。
自定义编辑路径(edit_uri)¶
自定义分支名、自定义 docs_dir、或文档与代码不同仓库时使用:
[project]
edit_uri = "edit/main/docs/"
拼接规则:repo_url + edit_uri 路径 + 文档文件在 docs_dir 中的路径。
文档与代码在不同仓库时,edit_uri 可设为绝对 URL(repo_url 仍指向项目仓库)。
自定义图标¶
zensical.toml
[project.theme.icon]
repo = "fontawesome/brands/git-alt"
edit = "material/pencil"
view = "material/eye"
常用仓库图标:fontawesome/brands/git、git-alt、github、gitlab、bitbucket 等。