Alcove CMS
Ru

Part II, Data

Feeds and file pages

A slug with an extension is written as that file: RSS, text, anything.

When the last part of a slug looks like a file name, such as feed.xml or ads.txt, the page is written as exactly that file. Alcove knows no feed format: you write the XML in a blueprint.xml, the same way as HTML.

A feed takes two alcoves, because a layout runs no query: a layout with the channel, and an alcove with the query and one item tile per row. The feed below shows the same rows as the pagination demo.

Live result This page is a static file, built once.

The feed at /docs/feeds/bulletin.xml, fetched by your browser just now:

Loading the feed...

Source the files behind the result above

content/pages/docs-feed.yaml

slug: docs/feeds/bulletin.xml
title: Reading room bulletin
alcove: rss
meta:
  description: Sample entries for the pagination and feed demos of the Alcove documentation.
nooks:
  main:
    - alcove: bulletinitems

content/alcoves/rss/blueprint.xml

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
  <title>{{ page.title }}</title>
  <link>{{ site.url }}/docs/pagination/</link>
  <description>{{ page.description }}</description>
{{ nook:main }}
</channel>
</rss>

content/alcoves/bulletinitems/alcove.yaml

query: |
  SELECT slug, title, summary,
         strftime('%d', published) || ' ' ||
         substr('JanFebMarAprMayJunJulAugSepOctNovDec', 3 * strftime('%m', published) - 2, 3) || ' ' ||
         strftime('%Y', published) || ' 09:00:00 +0000' AS pubdate
  FROM news
  ORDER BY published DESC

content/alcoves/bulletinitems/tile.xml

  <item>
    <title>{{ title }}</title>
    <link>{{ site.url }}/docs/pagination/#{{ slug }}</link>
    <guid isPermaLink="false">{{ slug }}</guid>
    <pubDate>{{ pubdate }}</pubDate>
    <description>{{ summary }}</description>
  </item>