Zola Hacker 是一个极简的 Zola 主题,灵感来自 Jekyll 的 Hacker theme。它是为想要写博客的开发者设计的。
在线预览.
在使用此主题之前,你需要安装 Zola ≥ 0.19.1。
git clone git@github.com:en9inerd/zola-hacker.git
cd zola-hacker
zola serve
# 在浏览器中打开 http://127.0.0.1:1111/刚才我们展示了如何直接运行主题。现在我们开始逐步在现有站点中安装主题。
zola init mysite下载此主题到你的 themes 目录:
cd mysite/themes
git clone git@github.com:en9inerd/zola-hacker.git
或者作为子模块安装:
cd mysite
git init # 如果你的项目已经是 git 仓库,请忽略此命令
git submodule add git@github.com:en9inerd/zola-hacker.git themes/hacker在站点目录下的 zola.toml 中启用主题:
theme = "hacker"
或者将 zola.toml 从主题目录复制到你的项目根目录:
cp themes/hacker/zola.toml zola.toml你可以将 content 从主题目录复制到你的项目中:
cp -r themes/hacker/content .
你可以根据需要修改或添加新文章到 content/posts、content/pages 或其他内容目录中。
只需在项目根路径下运行 zola serve:
zola serve
此命令将启动 Zola 开发 Web 服务器,默认访问地址为 http://127.0.0.1:1111。保存的更改将在浏览器中实时重新加载。
你可以自定义配置、模板和内容。查看此仓库中的 zola.toml、theme.toml、content 文件和模板文件以获取灵感。
你可以在 zola.toml 中自定义一些配置选项。
extra 选项之前的配置选项在 zola.toml 中设置 tags 分类法:
taxonomies = [
{ name = "tags" },
]extra 下的配置选项以下选项应位于 zola.toml 的 [extra] 下
language_code - 设置 HTML 文件语言(默认为 en-US)title_separator - 站点标题的分隔符,如 | 和 -(默认为 |)logo - logo 图片路径google_analytics - Google Analytics 跟踪 IDtimeformat - 博客文章发布日期的时间格式timezone - 博客文章发布日期的时区edit_page - 是否显示文章的 github 仓库编辑页面menu - 设置站点的菜单项contact_form_script_id - 基于 Google Script 的联系表单脚本 ID[extra.github] - 设置站点的 GitHub 元数据[extra.giscus] - 设置站点的 Giscus 设置以启用评论。请使用 Giscus 网站上的自己的设置[extra.opengraph] - 设置站点的 Open Graph 元数据[extra.pgp_key] - 在某些页面的页脚设置 pgp 密钥social_links - 在页脚设置社交媒体链接
...所有页面都扩展自 base.html,你可以根据需要自定义它们。
该主题提供了一些短代码来帮助你编写内容:
contact_form
contact_form 短代码基于 Google Apps Mail 无需服务器发送电子邮件。
它依赖于 zola.toml 中的 contact_form_script_id。
{{ contact_form() }}
cv
cv 短代码用于在页面中显示简历。简历数据以 yaml 格式存储在 data/cv 目录中。
{{ cv() }}
github_avatar
github_avatar 短代码用于显示 GitHub 头像图片。它依赖于 zola.toml 中的 extra.github.username。此外,你可以传递 size 作为参数。
{{ github_avatar(size=100) }}
projects
projects 短代码用于显示 GitHub 仓库。它依赖于 zola.toml 中的 extra.github.username 和页面 front matter 中的 extra.repo_names 来过滤仓库。
{{ projects() }}我们使用 GitHub Issues 作为 Zola Hacker Theme 的官方 bug 追踪器。请搜索 现有 issues。可能已经有人报告了同样的问题。
如果你的问题或想法尚未解决,打开一个新 issue。
Zola Hacker Theme 根据 MIT 许可证 分发。