mirror of
https://github.com/monstra-cms/monstra.git
synced 2025-08-05 20:57:49 +02:00
Sitemap Errors - ERROR 2 #175
This commit is contained in:
@@ -2,28 +2,46 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
$sitemap_html = '';
|
||||||
|
|
||||||
// Display pages
|
// Display pages
|
||||||
if (count($pages_list) > 0) {
|
if (count($pages_list) > 0) {
|
||||||
|
$children_started = false;
|
||||||
|
$first = true;
|
||||||
foreach ($pages_list as $page) {
|
foreach ($pages_list as $page) {
|
||||||
|
|
||||||
|
if (trim($page['parent']) === '' && $children_started) {
|
||||||
|
$children_started = false;
|
||||||
|
$sitemap_html .= "</li></ul></li>\n";
|
||||||
|
} elseif(!$first && (trim($page['parent']) !== '' && $children_started || trim($page['parent']) === '')) {
|
||||||
|
$sitemap_html .= "</li>\n";
|
||||||
|
}
|
||||||
|
|
||||||
if (trim($page['parent']) !== '') $parent = $page['parent'].'/'; else $parent = '';
|
if (trim($page['parent']) !== '') $parent = $page['parent'].'/'; else $parent = '';
|
||||||
if (trim($page['parent']) !== '') { echo '<ul>'."\n"; }
|
if (trim($page['parent']) !== '' && !$children_started) {
|
||||||
echo '<li><a href="'.Option::get('siteurl').'/'.$parent.$page['slug'].'">'.$page['title'].'</a></li>'."\n";
|
$children_started = true;
|
||||||
if (trim($page['parent']) !== '') { echo '</ul>'."\n"; }
|
$sitemap_html .= "<ul>\n";
|
||||||
|
}
|
||||||
|
$sitemap_html .= '<li><a href="'.Option::get('siteurl').'/'.$parent.$page['slug'].'">'.$page['title'].'</a>';
|
||||||
|
$first = false;
|
||||||
|
}
|
||||||
|
if (trim($page['parent']) === '' && $children_started) {
|
||||||
|
$sitemap_html .= "</li></ul></li>\n";
|
||||||
|
} else {
|
||||||
|
$sitemap_html .= "</li>\n";
|
||||||
}
|
}
|
||||||
if (count($components) == 0) { echo '<ul>'."\n"; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Display components
|
// Display components
|
||||||
if (count($components) > 0) {
|
if (count($components) > 0) {
|
||||||
if (count($pages_list) == 0) { echo '<ul>'."\n"; }
|
|
||||||
foreach ($components as $component) {
|
foreach ($components as $component) {
|
||||||
echo '<li><a href="'.Option::get('siteurl').'/'.$component.'">'.__(ucfirst($component), $component).'</a></li>'."\n";
|
$sitemap_html .= '<li><a href="'.Option::get('siteurl').'/'.$component.'">'.__(ucfirst($component), $component).'</a></li>'."\n";
|
||||||
}
|
}
|
||||||
if (count($pages_list) == 0) { echo '</ul>'."\n"; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo $sitemap_html;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
|
Reference in New Issue
Block a user