Skip to content

Instantly share code, notes, and snippets.

@vojtasvoboda
Created January 6, 2016 14:01
Show Gist options
  • Save vojtasvoboda/b4c4a497a15f0c62e241 to your computer and use it in GitHub Desktop.
Save vojtasvoboda/b4c4a497a15f0c62e241 to your computer and use it in GitHub Desktop.
Add new Sitemap type in OctoberCMS
<?php
public function boot()
{
// Add RainLab.Blog articles to sitemap
Event::listen('pages.menuitem.listTypes', function() {
return [
'blog-post' => 'Blog post',
'all-blog-posts' => 'All blog posts'
];
});
Event::listen('pages.menuitem.getTypeInfo', function($type) {
if ($type == 'blog-category' || $type == 'all-blog-categories')
return Category::getMenuTypeInfo($type);
});
Event::listen('pages.menuitem.resolveItem', function($type, $item, $url, $theme) {
if ($type == 'blog-category' || $type == 'all-blog-categories')
return Category::resolveMenuItem($item, $url, $theme);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment