分类法

Zola 将在目录中查找以下特定于类群的文件templates

  • $TAXONOMY_NAME/single.html
  • $TAXONOMY_NAME/list.html

如果找不到,它将尝试回退到以下通用模板文件:

  • taxonomy_single.html
  • taxonomy_list.html

仅当存在至少一个分类法且render设置为 时才需要分类法模板true

首先,TaxonomyTerm有以下字段:

name: String;
slug: String;
path: String;
permalink: String;
pages: Array<Page>;
page_count: Number;

TaxonomyConfig具有以下字段:

name: String,
paginate_by: Number?;
paginate_path: String?;
feed: Bool;
render: Bool;

🔗分类列表 ( list.html)

此模板从不分页,因此在所有情况下都会获取以下变量。

// The site config
config: Config;
// The data of the taxonomy, from the config
taxonomy: TaxonomyConfig;
// The current full permalink for that page
current_url: String;
// The current path for that page
current_path: String;
// All terms for that taxonomy
terms: Array<TaxonomyTerm>;
// The lang of the current page
lang: String;

🔗单项 ( single.html)

// The site config
config: Config;
// The data of the taxonomy, from the config
taxonomy: TaxonomyConfig;
// The current full permalink for that page
current_url: String;
// The current path for that page
current_path: String;
// The current term being rendered
term: TaxonomyTerm;
// The lang of the current page
lang: String;

分页分类术语也将获得一个paginator变量;有关详细信息,请参阅 分页页面。