zola/docs/content/documentation/templates/tags-categories.md

32 lines
1 KiB
Markdown
Raw Normal View History

2017-10-01 03:51:43 +00:00
+++
title = "Tags & Categories"
weight = 40
+++
Tags and categories actually get the same data but with different variable names.
The default templates for those pages are the following:
2017-11-14 16:55:49 +00:00
- `tags.html`: list of tags, gets variable `tags` sorted alphabetically
2017-10-01 03:51:43 +00:00
- `tag.html`: individual tag, gets variable `tag`
2017-11-14 16:55:49 +00:00
- `categories.html`: list of categories, gets variable `categories` sorted alphabetically
2017-10-01 03:51:43 +00:00
- `category.html`: individual category, gets variable `category`
You can override any of those templates by putting one with the same name in the `templates` directory.
`tags` and `categories` both are an array of `TaxonomyItem` sorted alphabetically, while `tag` and `category`
are a `TaxonomyItem`.
A `TaxonomyItem` has the following fields:
```ts
name: String;
slug: String;
permalink: String;
pages: Array<Page>;
```
2017-11-14 16:55:49 +00:00
As `pages` can span many sections, the `pages` array is sorted by date.
2017-10-01 03:51:43 +00:00
Currently, there is no way to define different taxonomy templates per section, change
the path used for them or paginate them.