One row, one fragment of HTML, picked by a condition.
One tile is enough for most lists. When rows need different markup, list several tiles with a condition each. For every row the first tile whose condition is true is used, and a tile without a condition always matches.
Conditions see the row's values as variables: comparisons, and, or, true and quoted strings, for example genre == 'gothic' and year < 1830.
Below, five rows and three tiles: a pick, a book out on loan, and everything else.
Live result This page is a static file, built once.
Pride and PrejudiceJane AustenOn the shelf
EmmaJane AustenOut on loan
FrankensteinMary ShelleyLibrarian's pick
Bleak HouseCharles DickensOut on loan
War and PeaceLeo TolstoyOn the shelf
Source the files behind the result above
content/alcoves/demo_shelf/alcove.yaml
fields:
- name: title
type: text
required: true
- name: author
type: text
required: true
- name: available
type: checkbox
- name: pick
type: checkbox
tiles:
- condition: "pick == true"
file: tile-pick.html
- condition: "available == false"
file: tile-loan.html
- file: tile.html
data:
- title: Pride and Prejudice
author: Jane Austen
available: true
pick: false
- title: Emma
author: Jane Austen
available: false
pick: false
- title: Frankenstein
author: Mary Shelley
available: true
pick: true
- title: Bleak House
author: Charles Dickens
available: false
pick: false
- title: War and Peace
author: Leo Tolstoy
available: true
pick: false