Create sitemap

This commit is contained in:
Bruno Rybársky 2024-02-15 10:19:52 +01:00
parent 92c470aade
commit 23b96a3942
2 changed files with 9 additions and 7 deletions

@ -20,7 +20,8 @@ if (!isLoggedIn()) {
if($routerRequest["site_name"] == "sitemap.xml") { if($routerRequest["site_name"] == "sitemap.xml") {
require "lib/sitemap.php"; require "lib/sitemap.php";
return generateSitemap(); echo generateSitemap();
exit();
} }
if ($routerRequest["type"] == "api") { if ($routerRequest["type"] == "api") {

@ -12,15 +12,16 @@ function initRouter(): array
$request_uri = array_slice($request_uri, -3, 3); $request_uri = array_slice($request_uri, -3, 3);
$routerRequest["site_name"] = basename($request_uri[1]);
$routerRequest["page_name"] = basename($request_uri[2]);
if (empty($routerRequest["site_name"])) { $routerRequest["site_name"] = $routerConfig["default_site"];
$routerRequest["site_name"] = $routerConfig["default_site"]; $routerRequest["page_name"] = $routerConfig["default_page"];
if(count($request_uri > 2)){
$routerRequest["page_name"] = basename($request_uri[2]);
} }
if(count($request_uri) > 1){
$routerRequest["site_name"] = basename($request_uri[1]);
if (empty($routerRequest["page_name"])) {
$routerRequest["page_name"] = $routerConfig["default_page"];
} }
if($_SERVER["REQUEST_METHOD"] == "POST"){ if($_SERVER["REQUEST_METHOD"] == "POST"){