Add Atom feed support to list pages

Introduce `feed` metadata option to enable Atom feeds
Update list item structure with standardized fields
Add `$feedUrl` template variable for autodiscovery
Improve date handling with raw/processed date separation
Document feed generation in architecture and rendering docs
Update template examples to use new item structure
This commit is contained in:
Ruben 2026-02-06 18:24:39 +01:00
parent 1cbfb67a4c
commit 069ce389ea
7 changed files with 128 additions and 48 deletions

View file

@ -194,6 +194,20 @@ hide_list = true
**Type:** Boolean
**Use case:** Section landing pages that should show content instead of list
### `feed`
Enable an Atom feed for this list page, served at `/{list-path}/feed.xml`.
```ini
feed = true
```
**Default:** `false` (no feed generated)
**Values:** `true` or `false`
**Type:** Boolean
**Applies to:** List pages only (directories with subdirectories)
**Effect:** Generates an Atom XML feed containing the full rendered content of each list item. Also adds an autodiscovery `<link>` tag in the HTML `<head>`.
## Language-Specific Overrides
Add language-specific sections to override fields:
@ -327,20 +341,19 @@ Folder: content/blog/2024-12-15-my-post/
## Metadata in List Items
When rendering list views, each item receives these metadata fields:
When rendering list views, each item in the `$items` array has these keys:
```php
$item = [
'url' => '/blog/my-post/',
'path' => '/content/blog/2024-12-15-my-post',
'title' => 'My Post',
'summary' => 'Short description',
'date' => '2024-12-15',
'formatted_date' => '15. desember 2024', // Language-specific
'cover_image' => '/blog/my-post/cover.jpg', // If exists
// All custom metadata fields...
'author' => 'Jane Doe',
'tags' => 'web,design',
'title' => 'My Post', // From metadata, heading, or folder name
'url' => '/blog/my-post/', // Full URL with trailing slash + lang prefix
'date' => '15. desember 2024', // Formatted for display (plugin-processed)
'rawDate' => '2024-12-15', // ISO YYYY-MM-DD (for feeds, <time> elements)
'summary' => 'Short description', // From metadata (nullable)
'cover' => '/blog/2024-12-15-my-post/cover.jpg', // Cover image URL (nullable)
'pdf' => '/blog/2024-12-15-my-post/doc.pdf', // First PDF URL (nullable)
'redirect' => null, // External redirect URL (nullable)
'dirPath' => '/path/to/content/blog/2024-12-15-my-post', // Filesystem path (internal)
];
```
@ -349,13 +362,17 @@ Access in list templates:
```php
<?php foreach ($items as $item): ?>
<article>
<h2><?= htmlspecialchars($item['title']) ?></h2>
<h2>
<a href="<?= $item['url'] ?>">
<?= htmlspecialchars($item['title']) ?>
</a>
</h2>
<?php if (isset($item['author'])): ?>
<p>By <?= htmlspecialchars($item['author']) ?></p>
<?php if ($item['date']): ?>
<time datetime="<?= $item['rawDate'] ?>"><?= $item['date'] ?></time>
<?php endif; ?>
<?php if (isset($item['summary'])): ?>
<?php if ($item['summary']): ?>
<p><?= htmlspecialchars($item['summary']) ?></p>
<?php endif; ?>
</article>