group
Group files by attribute
group(attributeName) groups files by an attribute. It process each file of a set and if a file contains an attribute, it will be collected into the group by attribute value.
The following methods are added to the site:
    attributeName() (in plural) - returns all attributes
    <attributeName>Group(<groupName>) - returns all files of a group with given name.

Example

1
Spig
2
.on('...')
3
._('PHASE')
4
.group('type')
5
;
Copied!
This example will scan all the files (file references). If file has attribute type:
1
---
2
title: Some cool title
3
type: A
4
---
Copied!
it will be collected and grouped in the A group (the name of the type).
Later on, you can get all the types using site.types() and all the files of a group using site.typeGroup('A').
Last modified 1yr ago
Export as PDF
Copy link
Contents
Example