Add basic sitemap
This commit is contained in:
parent
61131488c9
commit
4759b1577e
9
blog.php
9
blog.php
@ -220,6 +220,15 @@
|
|||||||
$CMS_INDEXING = false;
|
$CMS_INDEXING = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($CMS_SITEMAP)) {
|
||||||
|
foreach($posts as $k=>$v) {
|
||||||
|
if ($v->isPublic) {
|
||||||
|
echo "<url>\n\t<loc>" . htmlspecialchars($v->permalink) . "</loc>\n</url>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!isset($CMS_RSS))
|
if (!isset($CMS_RSS))
|
||||||
echo "<blog>";
|
echo "<blog>";
|
||||||
|
24
sitemap.php
Normal file
24
sitemap.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
$CMS_ACTIVE = true;
|
||||||
|
$CMS_SITEMAP = true;
|
||||||
|
|
||||||
|
require_once "shared.php";
|
||||||
|
|
||||||
|
if (true) {
|
||||||
|
header('Content-type: application/xml');
|
||||||
|
?>
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||||
|
<?php
|
||||||
|
foreach ($menuItems as $item) {
|
||||||
|
$url = $item['link'];
|
||||||
|
if ($url[0] == "/")
|
||||||
|
$url = getServerUrl() . $url;
|
||||||
|
echo "<url>\n\t<loc>" . htmlspecialchars($url) . "</loc>\n</url>\n";
|
||||||
|
}
|
||||||
|
require "blog.php";
|
||||||
|
?>
|
||||||
|
</urlset>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
Loading…
Reference in New Issue
Block a user