Answer the question
In order to leave comments, you need to log in
How to implement sitemap pagination in Django?
The sitemap is generated when you go to the page. Urls are about 700k, everything is very long and hard, the browser crashes.
Is it possible to somehow paginate, for example, 10k?
urls.py
...
from django.contrib.sitemaps import GenericSitemap, Sitemap
from django.contrib.sitemaps.views import sitemap
from ad.models import Offer, OfferArchive, SitemapSearchUrl
info_dict_offer = {
'queryset': Offer.objects.filter(for_index=True),
'date_field': 'created',
}
info_dict_archive = {
'queryset': OfferArchive.objects.all(),
'date_field': 'created',
}
info_dict_category = {
'queryset': SitemapSearchUrl.objects.all(),
'date_field': 'created',
}
sitemaps = {
'offer': GenericSitemap(info_dict_offer, priority=1),
'archive': GenericSitemap(info_dict_archive, priority=1),
'category': GenericSitemap(info_dict_category, priority=1),
}
urlpatterns = [
...
url(r'^sitemap.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps}),
...
]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question