Add category to sitemap
Closed this issue · 3 comments
alexanderloewe commented
Hello,
I want to add a category to sitemaps, but by adding the category
handle like an entry handle i don't get any output.
Is this option not available in seomate?
regards
mmikkel commented
You can add any type of element (including categories) to sitemaps, but you'll need to use the expanded criteria syntax for the sitemapConfig
config setting for all element types except entries.
Something like this should do it:
'sitemapConfig' => [
'elements' => [
'awesomecategories' => [
'elementType' => \craft\elements\Category::class,
'criteria' => ['group' => 'awesomeCategories'],
'params' => ['changefreq' => 'daily', 'priority' => 0.5],
],
],
],
alexanderloewe commented
Sorry, I did not see that one in the Doc. Works fine, thx.
Maybe it could make sens to add it as a separat point with a h2 or h3 to the doc. Something like:
Adding a Category to the Sitemap
'sitemapConfig' => [
'elements' => [
'awesomecategories' => [
'elementType' => \craft\elements\Category::class,
'criteria' => ['group' => 'awesomeCategories'],
'params' => ['changefreq' => 'daily', 'priority' => 0.5],
],
],
],
mmikkel commented
Yeah, I suppose that info could be easier to find. We'll look into improving that.