Add basic sitemap
This commit is contained in:
parent
61131488c9
commit
4759b1577e
9
blog.php
9
blog.php
@ -219,6 +219,15 @@
|
|||||||
apcu_store('posts', $posts, CACHE_POSTS_TTL);
|
apcu_store('posts', $posts, CACHE_POSTS_TTL);
|
||||||
$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))
|
||||||
|
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