Alcove CMS
Ru

Part II, Data

Detail pages

Every row gets a page of its own.

With item_url and a reveal.html, every row of an alcove gets a page of its own. The reveal template is a complete HTML document; it pulls in the header and footer with {{ alcove:name }}.

{{ item_url }} in a tile is that row's address, so the list can link to it. Like tiles, there can be several reveal templates with conditions; here books out on loan get a different one.

Live result This page is rendered on request.

Source the files behind the result above

content/alcoves/demo_bookpages/alcove.yaml

query: |
  SELECT b.slug, b.title, a.name AS author, b.year, b.genre, b.available, b.summary
  FROM books b
  JOIN authors a ON a.id = b.author_id
  ORDER BY b.title
item_url: docs/detail-pages/{{ slug }}
back_url: /docs/detail-pages/
reveal:
  - condition: "available == 1"
    file: reveal.html
  - file: reveal-loan.html

content/alcoves/demo_bookpages/tile.html

<li><a href="/{{ item_url }}/">{{ title }}</a> <span>{{ author }}, {{ year }}</span></li>

content/alcoves/demo_bookpages/reveal.html (main part)

    <p class="eyebrow">A detail page, made from one row</p>
    <h1>{{ title }}</h1>
    <p class="lede">{{ summary }}</p>
    <dl class="facts">
      <div><dt>Author</dt><dd>{{ author }}</dd></div>
      <div><dt>Year</dt><dd>{{ year }}</dd></div>
      <div><dt>Genre</dt><dd>{{ genre }}</dd></div>
      <div><dt>Shelf</dt><dd>On the shelf</dd></div>
    </dl>
  </article>
</main>
{{ alcove:colophon }}