Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add Collections Sitemap

Pacu2074d1fab0673
diff --git a/docs/integrations/seo.rst b/docs/integrations/seo.rst
index cd42fa8af4..2eca084e7a 100644
--- a/docs/integrations/seo.rst
+++ b/docs/integrations/seo.rst
@@ -6,7 +6,7 @@ Out of the box Saleor will automatically handle certain aspects of how search en
Sitemaps
--------
-A special resource reachable under the ``/sitemap.xml`` URL serves an up to date list of products and categories from your site in an easy to parse Sitemaps XML format understood by all major search engines.
+A special resource reachable under the ``/sitemap.xml`` URL serves an up to date list of products, categories and collections from your site in an easy to parse Sitemaps XML format understood by all major search engines.
Meta Tags
diff --git a/saleor/core/sitemaps.py b/saleor/core/sitemaps.py
index 7583755363..1e2dae53b6 100644
--- a/saleor/core/sitemaps.py
+++ b/saleor/core/sitemaps.py
@@ -1,6 +1,6 @@
from django.contrib.sitemaps import Sitemap
-from ..product.models import Category, Product
+from ..product.models import Category, Collection, Product
class ProductSitemap(Sitemap):
@@ -16,6 +16,14 @@ class CategorySitemap(Sitemap):
return categories.only('id', 'name', 'slug')
+class CollectionSitemap(Sitemap):
+
+ def items(self):
+ collections = Collection.objects.all().order_by('id')
+ return collections.only('id', 'name', 'slug')
+
+
sitemaps = {
'categories': CategorySitemap,
+ 'collections': CollectionSitemap,
'products': ProductSitemap}