List

A generic and flexible way to automatically list large sets of items

👁️ PREVIEW

Takes a list of data, filters it, loops through it, and displays each item with some component.

{%
  include list.html
  data="citations"
  component="citation"
  filters="group: featured"
  style="rich"
%}
ParameterDescription

data

The set of items to loop through, e.g. citations, posts, members, etc. If your list has date fields, it is also sorted from newest to oldest, and grouped into sections by year.

component

The component to show for each item in the list. The fields in your data should match what this component takes as parameters (except for style, see below).

filters

Filter your data by arbitrary fields and values. See detailed explanation below.

style

A style parameter to automatically pass to every component in the list, so you don't have to repetitively set it on every data item. This is the only field that works this way, because all other fields are likely to be different for each item, but you usually want the style to be the same within a list.

Technically you can use any structure of data and any component with the list component, but by default, the template comes with a few placeholder data lists and matching components for common needs.

Filters

The filters parameter is a comma separated list of field/value filters, like field: value, field: value, field: value. An item is considered a match only if all of the filters match.

The field is the particular field/key of the data item to check. The value is the value to compare against. value can be:

  • A plain string for a partial match.

  • Blank to match unspecified fields.

  • Ruby-flavored regex string for more complex matching.

Examples

Filter stringShow items that have...

role: programmer, alumni: true

role containing programmer AND alumni containing true

affiliation: ^CU$

affiliation EXACTLY equal to CU

category:

no specified category

description: .+

some specified/defined description

date: ^2020

date starting with 2020

role: ^(?!pi$)

role NOT equal to pi

Last updated