18 lines
420 B
Python
18 lines
420 B
Python
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})
|