nieuws/feed: canonical site references
authorMischa POSLAWSKY <perl@shiar.org>
Tue, 25 Jun 2019 18:16:29 +0000 (20:16 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Tue, 25 Jun 2019 18:16:29 +0000 (20:16 +0200)
Retain https protocol and append root slash in site links, as recommended by:
https://validator.w3.org/feed/check.cgi?url=https://lijtweg.nl/nieuws/feed

nieuws/feed/index.php

index 0a88cd4f3e06f2ea458d3aaa0d0ed826867f5a08..11138cea86cb37cbb233a80bfef401b22ac6c65c 100644 (file)
@@ -2,14 +2,14 @@
 ob_clean();
 header('Content-Type: application/atom+xml; charset=utf-8');
 print '<?xml version="1.0" encoding="utf-8"?>';
 ob_clean();
 header('Content-Type: application/atom+xml; charset=utf-8');
 print '<?xml version="1.0" encoding="utf-8"?>';
-$siteref = 'http://'.$_SERVER['HTTP_HOST'];
+$siteref = (empty($_SERVER['HTTPS']) ? 'http' : 'https') . '://' . $_SERVER['HTTP_HOST'];
 ?>
 
 <feed xmlns="http://www.w3.org/2005/Atom">
        <title>Lijtweg.nl</title>
        <subtitle>Nieuwsberichten</subtitle>
 ?>
 
 <feed xmlns="http://www.w3.org/2005/Atom">
        <title>Lijtweg.nl</title>
        <subtitle>Nieuwsberichten</subtitle>
-       <id><?= $siteref ?></id>
-       <link href="<?= $siteref ?>" />
+       <id><?= $siteref ?>/</id>
+       <link href="<?= $siteref ?>/" />
        <link href="<?= $siteref . $_SERVER['REQUEST_URI'] ?>" rel="self" />
        <author><name>Lijtweg</name></author>
 <?php
        <link href="<?= $siteref . $_SERVER['REQUEST_URI'] ?>" rel="self" />
        <author><name>Lijtweg</name></author>
 <?php
@@ -31,7 +31,8 @@ foreach ($pages as $i => $page) {
                <title><?= $article->title ?></title>
                <published><?= $article->dateiso ?></published>
                <updated><?= $article->dateiso ?></updated>
                <title><?= $article->title ?></title>
                <published><?= $article->dateiso ?></published>
                <updated><?= $article->dateiso ?></updated>
-               <content type="html"><?= htmlspecialchars($article->body) ?></content>
+               <content type="html"><?= htmlspecialchars($article->body) ?>
+               </content>
 <?php
        if ($article->thumb) {
                printf("\t\t".'<link rel="enclosure" type="%s" length="%d" href="%s" />'."\n",
 <?php
        if ($article->thumb) {
                printf("\t\t".'<link rel="enclosure" type="%s" length="%d" href="%s" />'."\n",