Add author and timestamp uniqueness to feed XML output
This commit is contained in:
parent
f1447049e4
commit
67e6f1269a
1 changed files with 7 additions and 1 deletions
|
|
@ -103,10 +103,16 @@ if (str_ends_with($ctx->requestPath, 'feed.xml')) {
|
|||
echo ' <link href="' . htmlspecialchars($feedUrl) . '" rel="self"/>' . "\n";
|
||||
echo ' <id>' . htmlspecialchars($listUrl) . '</id>' . "\n";
|
||||
echo ' <updated>' . $updated . 'T00:00:00Z</updated>' . "\n";
|
||||
$feedAuthor = $metadata['author'] ?? $feedTitle;
|
||||
echo ' <author><name>' . htmlspecialchars($feedAuthor) . '</name></author>' . "\n";
|
||||
|
||||
$dateCounts = [];
|
||||
foreach ($items as $item) {
|
||||
$absoluteUrl = $baseUrl . $item['url'];
|
||||
$itemDate = ($item['rawDate'] ?? date('Y-m-d')) . 'T00:00:00Z';
|
||||
$rawDate = $item['rawDate'] ?? date('Y-m-d');
|
||||
$dateIndex = $dateCounts[$rawDate] ?? 0;
|
||||
$dateCounts[$rawDate] = $dateIndex + 1;
|
||||
$itemDate = $rawDate . 'T00:00:' . sprintf('%02d', $dateIndex) . 'Z';
|
||||
|
||||
echo ' <entry>' . "\n";
|
||||
echo ' <title>' . htmlspecialchars($item['title']) . '</title>' . "\n";
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue