taika.ext.collections
– Grouping content¶
This extension groups documents using patterns specified by the user. It also order those documents using certain keys specified by the user.
It uses the patterns listed from top to bottom, the documents not included in the first
pattern are not matched against the second pattern, so be liberal in the first pattern
and more restricted at the bottom. Also, if the pattern starts with !
(exclamation mark)
the documents matching will be excluded. For example:
collections:
posts:
patterns:
- "posts/*" # Include all under posts
- "!posts/index.rst" # Ignore posts/index.rst
Event¶
This extension is subscribed to the site-post-read
event.
Process¶
- Setup where the
collections
keys is retrieved. - When the extension is called, scans the documents checking their
path
. - If
path
matches the patterns provided, it’s added to the collection. - Finally, the attribute
collections
is created ontaika.Taika
.
Configuration¶
# Match all but the index.rst file on posts/
collections:
posts:
patterns:
- "posts/*" # Include all under posts
- "!posts/index.rst" # Ignore posts/index.rst
-
collections
(dict)¶ Default: {}
A dictionary where each key specifies the name of the collection.
-
collection.
patterns
(list)¶ Default: [‘’] (empty string)
The patterns to be used in order to group the files. By default, it matches nothing.