sitemap.xml: common protocol listing all pages
authorMischa POSLAWSKY <perl@shiar.org>
Tue, 15 Oct 2019 03:56:38 +0000 (05:56 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Thu, 17 Oct 2019 00:30:13 +0000 (02:30 +0200)
Minimal implementations of sitemap for make benefit glorious engines of
search.

sitemap.xml/index.php [new file with mode: 0644]

diff --git a/sitemap.xml/index.php b/sitemap.xml/index.php
new file mode 100644 (file)
index 0000000..7d28815
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+ob_clean();
+header('Content-Type: application/atom+xml; charset=utf-8');
+print '<?xml version="1.0" encoding="utf-8"?>';
+$siteref = (empty($_SERVER['HTTPS']) ? 'http' : 'https') . '://' . $_SERVER['HTTP_HOST'];
+?>
+
+<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
+<?php
+$search = new PageSearch();
+foreach ($search->files() as $link) {
+       $article = new ArchiveArticle($link);
+       print '<url>';
+       print "<loc>$siteref/{$article->link}</loc>";
+       if ($article->last) {
+               print "<lastmod>{$article->lastiso}</lastmod>";
+       }
+       print "</url>\n";
+}
+?>
+</urlset>
+<?php
+exit;