创建主题

创建主题与使用 Zola 创建普通站点完全一样,只是您需要使用许多Tera 块以允许用户轻松修改它。

🔗开始

如前所述,主题就像任何网站一样。从跑步开始zola init MY_THEME_NAME

将该网站变成主题唯一需要做的就是添加一个theme.toml包含以下字段的配置文件:

name = "my theme name"
description = "A classic blog theme"
license = "MIT"
homepage = "https://github.com/getzola/hyde"
# The minimum version of Zola required
min_version = "0.4.0"
# An optional live demo URL
demo = ""

# Any variable there can be overridden in the end user `config.toml`
# You don't need to prefix variables by the theme name but as this will
# be merged with user data, some kind of prefix or nesting is preferable
# Use snake_casing to be consistent with the rest of Zola
[extra]

# The theme author info: you!
[author]
name = "Vincent Prouillet"
homepage = "https://vincent.is"

# If this is porting a theme from another static site engine, provide
# the info of the original author here
[original]
author =  "mdo"
homepage = "https://markdotto.com/"
repo = "https://www.github.com/mdo/hyde"

一个可以用作示例的简单主题是Hyde

🔗致力于一个主题

由于主题只是一个站点,您可以简单地使用zola serve和更改您的主题,并按预期进行实时重新加载。

确保提交每个目录(包括content),以便其他人能够从您的存储库构建主题。

如果您希望您的主题出现在本网站的主题部分,请确保该主题满足以下三个要求:

  • 有一个screenshot.png正在运行的主题,最大尺寸约为 2000x1000
  • 彻底README.md解释如何使用主题和任何其他重要信息
  • 具有相当高的质量

当您的主题准备就绪后,您可以 按照 README 中的流程将其提交到主题存储库。