Alcove CMS
Ru

Part I, Basics

Tile variants

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 Prejudice Jane Austen On the shelf
  • Emma Jane Austen Out on loan
  • Frankenstein Mary Shelley Librarian's pick
  • Bleak House Charles Dickens Out on loan
  • War and Peace Leo Tolstoy On 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

content/alcoves/demo_shelf/tile-pick.html

<li class="shelf-item is-pick"><span class="shelf-title">{{ title }}</span> <span class="shelf-by">{{ author }}</span> <span class="shelf-state">Librarian's pick</span></li>

content/alcoves/demo_shelf/tile-loan.html

<li class="shelf-item is-out"><span class="shelf-title">{{ title }}</span> <span class="shelf-by">{{ author }}</span> <span class="shelf-state">Out on loan</span></li>

content/alcoves/demo_shelf/tile.html

<li class="shelf-item"><span class="shelf-title">{{ title }}</span> <span class="shelf-by">{{ author }}</span> <span class="shelf-state">On the shelf</span></li>