A folder of Markdown files is a data source - a small flat-file CMS. The files live in _content/<name>/, and {collection} iterates them: each file is a row, the keys of its front matter (YAML between two --- lines) are its fields, and three are added - slug, the file name without .md; body, the Markdown written as HTML; and source, the Markdown as it was.

This manual has a folder _content/news/ with two files. The newest first:

PHP
HTML
fragments/collections_1.pad
Result
{collection 'news', sort='date DESC'}
<h3>{$title}</h3>
<p><small>{$date} - {$author}</small></p>
{!body}
{/collection}

Collections

2026-10-06 - Herbert

A folder of Markdown files is now a data source:

  • one file per row
  • front matter as fields

Markdown arrives

2026-10-05 - Herbert

The markdown tag and pipe write Markdown as HTML.

One post

A list links to the page of a post with its slug - ?news/post&slug={$slug} - and that page names it with the slug option. A slug that names no file gives no rows, so the @else@ part answers.

PHP
fragments/collections_2.php
HTML
fragments/collections_2.pad
Result
<?php

$slug
= 'markdown';

?>
{collection 'news', slug=$slug}
<h3>{$title}</h3>
{!body}
@else@
No such post.
{/collection}

Markdown arrives

The markdown tag and pipe write Markdown as HTML.