A collection in liara groups content together into an optionally ordered collection. This grouping is efficient, i.e. iterating a sorted collection does not incur any sorting cost. It is also efficient to look up the next/previous entry in an collection.


A collection definition consists of three elements:

  • The name

  • The filter – this is an URL pattern which defines all elements that are in this collection.

  • The ordering – optionally specifies how the collection should be ordered. This is a metadata accessor, to access nested fields, separate the individual accesses using .. For instance, date.year will access the date metadata field first, and then the year attribute. If you want to reverse the order, add a leading -, for example -date.year.

For example:

  filter: '/blog/**'
  order_by: 'date'

Defines a collection named blog, which contains all elements under /blog, ordered by the date metadata field.


Collections can be obtained from the Site object using get_collection(). If ordered, get_next_in_collection() and get_previous_in_collection() can be used to provide next/previous links. The other use of collections are Indices.