| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- from django.contrib.sitemaps import Sitemap
- from blog.models import Blog, Cat_Blog
- from core.models import Page
- from django.urls import reverse
- class BlogSitemap(Sitemap):
- """Sitemap pour les articles de blog"""
- changefreq = "weekly"
- priority = 0.8
- protocol = 'https'
- def items(self):
- return Blog.objects.filter(b_publier=True).order_by('-b_publdate')
- def lastmod(self, obj):
- return obj.b_publdate
- def location(self, obj):
- return reverse('blog_play', args=[obj.b_titre_slugify])
- class CategorySitemap(Sitemap):
- """Sitemap pour les catégories"""
- changefreq = "monthly"
- priority = 0.6
- protocol = 'https'
- def items(self):
- return Cat_Blog.objects.all()
- def location(self, obj):
- return reverse('blog_tag', args=[obj.cb_titre_slgify])
- class PageSitemap(Sitemap):
- """Sitemap pour les pages statiques"""
- changefreq = "monthly"
- priority = 0.5
- protocol = 'https'
- def items(self):
- return Page.objects.filter(p_publier=True, p_type='page')
- def location(self, obj):
- return obj.p_adresse
- class StaticViewSitemap(Sitemap):
- """Sitemap pour les vues statiques"""
- priority = 0.5
- changefreq = 'monthly'
- protocol = 'https'
- def items(self):
- return ['blog_index']
- def location(self, item):
- return reverse(item)
|