Collections allow you to group, paginate, and list related content. You define a collection under website.collections.<name> and point it to a sub-directory within your content.dir using the path key.
Collection Options
path: The relative path inside content.dir (e.g., "blog/posts").pagination.perPage: Number of items to show per listing page.rss.enable: Boolean to enable/disable RSS feed generation (e.g., /blog/index.xml).taxonomies: A list of keys (e.g., [ "tags" "series" ]) to enable grouping by frontmatter keys.
Using Taxonomies
To use a taxonomy, add the key to the taxonomies list in your collection config. Then, in your markdown files, include that key in the YAML frontmatter:
---
tags:
- emacs
---
nixtml will automatically generate taxonomy pages (e.g., /blog/tags/emacs/index.html) using the website.layouts.taxonomy template.
Context available in Collection and Taxonomy templates
When rendering collection or taxonomy layouts, you have access to the following context attributes:
pageNumber: Current page number.totalPages: Total amount of pages.items: List of posts/items on the current page.hasNext: Boolean indicating if a next page exists.hasPrev: Boolean indicating if a previous page exists.nextPageURL: URL to the next page.prevPageURL: URL to the previous page.title: (Taxonomy only) The name of the tag or term being displayed.
website.collections.blog = {
path = "blog/posts";
pagination.perPage = 5;
rss.enable = true;
taxonomies = [ "tags" "series" ];
};