2018-07-16 08:54:05 +00:00
|
|
|
+++
|
|
|
|
title = "Taxonomies"
|
|
|
|
weight = 40
|
|
|
|
+++
|
|
|
|
|
2018-10-18 21:09:32 +00:00
|
|
|
Zola will look up the following files in the `templates` directory:
|
2018-07-16 08:54:05 +00:00
|
|
|
|
|
|
|
- `$TAXONOMY_NAME/single.html`
|
|
|
|
- `$TAXONOMY_NAME/list.html`
|
|
|
|
|
|
|
|
First, a `TaxonomyTerm` has the following fields:
|
|
|
|
|
|
|
|
```ts
|
|
|
|
name: String;
|
|
|
|
slug: String;
|
|
|
|
permalink: String;
|
|
|
|
pages: Array<Page>;
|
|
|
|
```
|
|
|
|
|
2018-11-29 19:24:45 +00:00
|
|
|
and a `TaxonomyConfig`:
|
|
|
|
|
|
|
|
```ts
|
|
|
|
name: String,
|
|
|
|
slug: String,
|
|
|
|
paginate_by: Number?;
|
|
|
|
paginate_path: String?;
|
|
|
|
rss: Bool;
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### Taxonomy list (`list.html`)
|
|
|
|
|
|
|
|
This template is never paginated and therefore get the following variables in all cases.
|
2018-07-16 08:54:05 +00:00
|
|
|
|
|
|
|
```ts
|
|
|
|
// 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;
|
2018-11-29 19:24:45 +00:00
|
|
|
// All terms for that taxonomy
|
|
|
|
terms: Array<TaxonomyTerm>;
|
2019-08-10 16:53:16 +00:00
|
|
|
// The lang of the current page
|
|
|
|
lang: String;
|
2018-07-16 08:54:05 +00:00
|
|
|
```
|
|
|
|
|
2018-11-29 19:24:45 +00:00
|
|
|
|
|
|
|
### Single term (`single.html`)
|
2018-07-16 08:54:05 +00:00
|
|
|
```ts
|
|
|
|
// 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;
|
2018-11-29 19:24:45 +00:00
|
|
|
// The current term being rendered
|
|
|
|
term: TaxonomyTerm;
|
2019-08-10 16:53:16 +00:00
|
|
|
// The lang of the current page
|
|
|
|
lang: String;
|
2018-07-16 08:54:05 +00:00
|
|
|
```
|
|
|
|
|
2019-05-27 12:35:14 +00:00
|
|
|
A paginated taxonomy term will also get a `paginator` variable, see the [pagination page](@/documentation/templates/pagination.md)
|
2018-11-29 19:24:45 +00:00
|
|
|
for more details on that.
|