Create sitemap
This commit is contained in:
parent
e37387f084
commit
3344d7412c
@ -20,7 +20,7 @@ if (!isLoggedIn()) {
|
|||||||
|
|
||||||
if($routerRequest["site_name"] == "sitemap.xml") {
|
if($routerRequest["site_name"] == "sitemap.xml") {
|
||||||
require "lib/sitemap.php";
|
require "lib/sitemap.php";
|
||||||
echo generateSitemap();
|
generateSitemap();
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
require_once "lib/account.php";
|
require_once "lib/account.php";
|
||||||
|
|
||||||
|
|
||||||
function generateSitemap(): string {
|
function generateSitemap(): void{
|
||||||
global $routerConfig;
|
global $routerConfig;
|
||||||
|
|
||||||
$site_dirs = array_diff(scandir($routerConfig["page_dir"]), array('.', '..'));
|
$site_dirs = array_diff(scandir($routerConfig["page_dir"]), array('.', '..'));
|
||||||
@ -52,5 +52,6 @@ function generateSitemap(): string {
|
|||||||
|
|
||||||
$sitemap .= '</urlset>' . PHP_EOL;
|
$sitemap .= '</urlset>' . PHP_EOL;
|
||||||
|
|
||||||
return $sitemap;
|
header('Content-type: application/xml');
|
||||||
|
echo $sitemap;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user