forked from dignajar/nibbleblog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sitemap.php
45 lines (35 loc) · 1.21 KB
/
sitemap.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
header("Content-type: text/xml; charset=utf-8");
require('admin/boot/sitemap.bit');
// =====================================================================
// Sitemap
// =====================================================================
$smap = '<?xml version="1.0" encoding="utf-8"?>' . PHP_EOL;
$smap.= '<urlset
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">' . PHP_EOL;
$smap.='<url>' . PHP_EOL;
$smap.='<loc>'.$settings['url'].'</loc>' . PHP_EOL;
$smap.='<changefreq>always</changefreq>' . PHP_EOL;
$smap.='</url>' . PHP_EOL;
foreach($pages as $page)
{
$permalink = Page::permalink(true);
$smap.='<url>' . PHP_EOL;
$smap.='<loc>'.$permalink.'</loc>' . PHP_EOL;
$smap.='<changefreq>always</changefreq>' . PHP_EOL;
$smap.='</url>' . PHP_EOL;
}
foreach($posts as $post)
{
$permalink = Post::permalink(true);
$smap.='<url>' . PHP_EOL;
$smap.='<loc>'.$permalink.'</loc>' . PHP_EOL;
$smap.='<changefreq>always</changefreq>' . PHP_EOL;
$smap.='</url>' . PHP_EOL;
}
$smap.= '</urlset>';
echo $smap;
?>