Add sitemap
This commit is contained in:
parent
97f2564293
commit
191fc0780c
3 changed files with 30 additions and 0 deletions
18
gallery/sitemaps.py
Normal file
18
gallery/sitemaps.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
from django.contrib.sitemaps import Sitemap
|
||||
from django.urls import reverse
|
||||
|
||||
from .models import Album
|
||||
|
||||
|
||||
class AlbumSitemap(Sitemap):
|
||||
changefreq = "monthly"
|
||||
priority = 0.8
|
||||
|
||||
def items(self):
|
||||
return Album.objects.filter(is_public=True)
|
||||
|
||||
def lastmod(self, obj):
|
||||
return obj.album_date
|
||||
|
||||
def location(self, obj):
|
||||
return reverse('gallery:album_url', kwargs={'album_slug': obj.slug})
|
Loading…
Add table
Add a link
Reference in a new issue