diff --git a/bl-kernel/dbsite.class.php b/bl-kernel/dbsite.class.php index b130fb08..83395946 100644 --- a/bl-kernel/dbsite.class.php +++ b/bl-kernel/dbsite.class.php @@ -90,6 +90,21 @@ class dbSite extends dbJSON { $filter = $this->getField('uriCategory'); return $this->url().ltrim($filter, '/'); + + } + + // Returns the URL of the rss.xml file + // You need to have enabled the plugin RSS + public function rss() + { + return DOMAIN_BASE.'rss.xml'; + } + + // Returns the URL of the sitemap.xml file + // You need to have enabled the plugin Sitemap + public function sitemap() + { + return DOMAIN_BASE.'sitemap.xml'; } public function twitter() diff --git a/bl-kernel/functions.php b/bl-kernel/functions.php index b5d062e2..f877a3d5 100644 --- a/bl-kernel/functions.php +++ b/bl-kernel/functions.php @@ -163,3 +163,14 @@ function buildPagesFor($for, $categoryKey=false, $tagKey=false) } return $pages; } + +function pluginEnabled($pluginName) { + global $plugins; + + $pluginClass = 'plugin'.Text::firstCharUp($pluginName); + if( isset($plugins['all'][$pluginClass]) ) { + return $plugins['all'][$pluginClass]->installed(); + } + + return false; +} \ No newline at end of file diff --git a/bl-plugins/sitemap/plugin.php b/bl-plugins/sitemap/plugin.php index ba68bc1d..5d6a7137 100644 --- a/bl-plugins/sitemap/plugin.php +++ b/bl-plugins/sitemap/plugin.php @@ -6,7 +6,6 @@ class pluginSitemap extends Plugin { { global $Site; global $dbPages; - global $Url; $xml = ''; $xml .= ''; @@ -16,10 +15,14 @@ class pluginSitemap extends Plugin { $xml .= ''; // Get keys of pages - $keys = array_keys($dbPages->db); + $keys = $dbPages->db; + unset($keys['error']); + $keys = array_keys($keys); + foreach($keys as $pageKey) { // Create the page object from the page key $page = buildPage($pageKey); + $xml .= ''; $xml .= ''.$page->permalink().''; $xml .= ''.$page->dateRaw(SITEMAP_DATE_FORMAT).''; diff --git a/bl-themes/editorial/index.php b/bl-themes/editorial/index.php index 636ab8cd..9a3022c0 100644 --- a/bl-themes/editorial/index.php +++ b/bl-themes/editorial/index.php @@ -26,6 +26,17 @@
  • Facebook
  • Instagram
  • GitHub
  • + RSS'; + } + + // Check if the plugin Sitemap is enabled + if( pluginEnabled('sitemap') ) { + echo '
  • Sitemap
  • '; + } + ?>