diff --git a/system/htmly.php b/system/htmly.php
index 6edfe1e..1b30351 100644
--- a/system/htmly.php
+++ b/system/htmly.php
@@ -2836,30 +2836,14 @@ get('/:static', function ($static) {
header("Location: $url");
}
- if ($static === 'sitemap.xml' || $static === 'sitemap.base.xml' || $static === 'sitemap.post.xml' || $static === 'sitemap.static.xml' || $static === 'sitemap.tag.xml' || $static === 'sitemap.archive.xml' || $static === 'sitemap.author.xml' || $static === 'sitemap.category.xml' || $static === 'sitemap.type.xml') {
-
- header('Content-Type: text/xml');
-
+ if (strpos($static, ".xml") !== false) {
if ($static === 'sitemap.xml') {
- generate_sitemap('index');
- } elseif ($static === 'sitemap.base.xml') {
- generate_sitemap('base');
- } elseif ($static === 'sitemap.post.xml') {
- generate_sitemap('post');
- } elseif ($static === 'sitemap.static.xml') {
- generate_sitemap('static');
- } elseif ($static === 'sitemap.tag.xml') {
- generate_sitemap('tag');
- } elseif ($static === 'sitemap.archive.xml') {
- generate_sitemap('archive');
- } elseif ($static === 'sitemap.author.xml') {
- generate_sitemap('author');
- } elseif ($static === 'sitemap.category.xml') {
- generate_sitemap('category');
- } elseif ($static === 'sitemap.type.xml') {
- generate_sitemap('type');
+ $sitemap = 'index.xml';
+ } else {
+ $sitemap = str_replace('sitemap.', '', $static);
}
-
+ header('Content-Type: text/xml');
+ generate_sitemap($sitemap);
die;
} elseif ($static === 'admin') {
if (login()) {
@@ -2981,7 +2965,11 @@ get('/:static', function ($static) {
}
$post = find_page($static);
-
+
+ if (!$post) {
+ not_found();
+ }
+
if (array_key_exists('prev', $post)) {
$prev = $post['prev'];
} else {
@@ -2994,10 +2982,6 @@ get('/:static', function ($static) {
$next = array();
}
- if (!$post) {
- not_found();
- }
-
$post = $post['current'];
if (config("views.counter") == "true") {
diff --git a/system/includes/functions.php b/system/includes/functions.php
index 1a171b6..2d413f8 100644
--- a/system/includes/functions.php
+++ b/system/includes/functions.php
@@ -2802,7 +2802,7 @@ function generate_sitemap($str)
echo '';
- if ($str == 'index') {
+ if ($str == 'index.xml') {
echo '';
@@ -2840,7 +2840,7 @@ function generate_sitemap($str)
echo '';
- } elseif ($str == 'base') {
+ } elseif ($str == 'base.xml') {
$priority = (config('sitemap.priority.base')) ? config('sitemap.priority.base') : '1.0';
@@ -2852,7 +2852,7 @@ function generate_sitemap($str)
echo '';
- } elseif ($str == 'post') {
+ } elseif ($str == 'post.xml') {
$priority = (config('sitemap.priority.post')) ? config('sitemap.priority.post') : $default_priority;
@@ -2870,7 +2870,7 @@ function generate_sitemap($str)
echo '';
- } elseif ($str == 'static') {
+ } elseif ($str == 'static.xml') {
$priority = (config('sitemap.priority.static')) ? config('sitemap.priority.static') : $default_priority;
@@ -2888,7 +2888,7 @@ function generate_sitemap($str)
echo '';
- } elseif ($str == 'tag') {
+ } elseif ($str == 'tag.xml') {
$priority = (config('sitemap.priority.tag')) ? config('sitemap.priority.tag') : $default_priority;
@@ -2928,7 +2928,7 @@ function generate_sitemap($str)
echo '';
- } elseif ($str == 'archive') {
+ } elseif ($str == 'archive.xml') {
$priorityDay = (config('sitemap.priority.archiveDay')) ? config('sitemap.priority.archiveDay') : $default_priority;
$priorityMonth = (config('sitemap.priority.archiveMonth')) ? config('sitemap.priority.archiveMonth') : $default_priority;
@@ -2971,7 +2971,7 @@ function generate_sitemap($str)
echo '';
- } elseif ($str == 'author') {
+ } elseif ($str == 'author.xml') {
$priority = (config('sitemap.priority.author')) ? config('sitemap.priority.author') : $default_priority;
@@ -2997,7 +2997,7 @@ function generate_sitemap($str)
echo '';
- } elseif ($str == 'category') {
+ } elseif ($str == 'category.xml') {
$priority = (config('sitemap.priority.category')) ? config('sitemap.priority.category') : $default_priority;
@@ -3035,7 +3035,7 @@ function generate_sitemap($str)
echo '';
- } elseif ($str == 'type') {
+ } elseif ($str == 'type.xml') {
$priority = (config('sitemap.priority.type')) ? config('sitemap.priority.type') : $default_priority;