From 3344d7412c3c197d2682a533523e976eedb690ca Mon Sep 17 00:00:00 2001 From: bruno Date: Thu, 15 Feb 2024 10:41:48 +0100 Subject: [PATCH] Create sitemap --- index.php | 2 +- lib/sitemap.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/index.php b/index.php index 3e03a20..0196cd2 100644 --- a/index.php +++ b/index.php @@ -20,7 +20,7 @@ if (!isLoggedIn()) { if($routerRequest["site_name"] == "sitemap.xml") { require "lib/sitemap.php"; - echo generateSitemap(); + generateSitemap(); exit(); } diff --git a/lib/sitemap.php b/lib/sitemap.php index 09fa79d..7523edb 100644 --- a/lib/sitemap.php +++ b/lib/sitemap.php @@ -2,7 +2,7 @@ require_once "lib/account.php"; -function generateSitemap(): string { +function generateSitemap(): void{ global $routerConfig; $site_dirs = array_diff(scandir($routerConfig["page_dir"]), array('.', '..')); @@ -52,5 +52,6 @@ function generateSitemap(): string { $sitemap .= '' . PHP_EOL; - return $sitemap; + header('Content-type: application/xml'); + echo $sitemap; } \ No newline at end of file