Skip to content

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

Add Category sitemap

Pacu271cffa554801
diff --git a/saleor/core/sitemaps.py b/saleor/core/sitemaps.py
index 1304deae11..1294da3deb 100644
--- a/saleor/core/sitemaps.py
+++ b/saleor/core/sitemaps.py
@@ -2,7 +2,7 @@ from __future__ import unicode_literals
from django.contrib.sitemaps import Sitemap
-from ..product.models import Product
+from ..product.models import Category, Product
class ProductSitemap(Sitemap):
@@ -10,5 +10,13 @@ class ProductSitemap(Sitemap):
def items(self):
return Product.objects.only('id', 'name').order_by('-id')
+class CategorySitemap(Sitemap):
-sitemaps = {'products': ProductSitemap}
+ def items(self):
+ categories = Category.objects.all().order_by('id')
+ return categories.only('id', 'name', 'slug')
+
+sitemaps = {
+ 'categories': CategorySitemap,
+ 'products': ProductSitemap
+}