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 |
|---|---|---|
|
Collections2026-10-06 - Herbert A folder of Markdown files is now a data source:
Markdown arrives2026-10-05 - Herbert The markdown tag and pipe write Markdown as HTML. |
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 |
|---|---|---|
|
|
Markdown arrivesThe markdown tag and pipe write Markdown as HTML. |
body is HTML; print it raw with {!body}. Raw HTML in a file is escaped unless the tag has the html option.sort, first, where and the other handling options work on the rows as on any data._data file: the page's directory, its parents, then _common.padCollection('news') gives the same rows.