nieuws/feed: prefer article dates from metadata
[minimedit.git] / nieuws / feed / index.php
index fdb91d5a66b77c0442d1ce9545c3d96f5239db02..0cd5ecb84e016df6ed7fb55ffca9eac059edae43 100644 (file)
@@ -1,6 +1,6 @@
 <?php
-ob_clean();
 header('Content-Type: application/atom+xml; charset=utf-8');
+header('Access-Control-Allow-Origin: *');
 print '<?xml version="1.0" encoding="utf-8"?>';
 $siteref = (empty($_SERVER['HTTPS']) ? 'http' : 'https') . '://' . $_SERVER['HTTP_HOST'];
 ?>
@@ -11,6 +11,7 @@ $siteref = (empty($_SERVER['HTTPS']) ? 'http' : 'https') . '://' . $_SERVER['HTT
        <id><?= $siteref ?>/</id>
        <link href="<?= $siteref ?>/" />
        <link href="<?= $siteref . $_SERVER['REQUEST_URI'] ?>" rel="self" />
+       <icon>/favicon.png</icon>
        <author><name>Lijtweg</name></author>
 <?php
 $root = preg_replace('{/feed$}', '', $Page) . "/2???";
@@ -28,11 +29,12 @@ foreach ($pages as $i => $page) {
                <id><?= $siteref . '/' . $article->link ?></id>
                <link href="<?= $siteref . '/' . $article->link ?>" />
                <title><?= $article->title ?></title>
-               <published><?= $article->dateiso ?></published>
-               <updated><?= $article->dateiso ?></updated>
-               <content type="html"><?= htmlspecialchars($article->body) ?>
-               </content>
+               <published><?= $article->meta['article:published_time'] ?? $article->dateiso ?></published>
+               <updated><?= $article->meta['article:modified_time'] ?? $article->dateiso ?></updated>
 <?php
+       if ($article->teaser) {
+               printf("\t\t<summary>%s</summary>\n", htmlspecialchars($article->teaser));
+       }
        if ($article->thumb) {
                printf("\t\t".'<link rel="enclosure" type="%s" href="%s"%s />'."\n",
                        'image/jpeg',
@@ -41,6 +43,8 @@ foreach ($pages as $i => $page) {
                );
        }
 ?>
+               <content type="html"><?= htmlspecialchars($article->story) ?>
+               </content>
        </entry>
 <?php
 }