Coverage for website/thabloid/sitemaps.py: 93.75%
16 statements
« prev ^ index » next coverage.py v7.6.7, created at 2025-08-14 10:31 +0000
« prev ^ index » next coverage.py v7.6.7, created at 2025-08-14 10:31 +0000
1from django.contrib import sitemaps
2from django.urls import reverse
4from .models import Thabloid
7class StaticViewSitemap(sitemaps.Sitemap):
8 """Sitemap of the static thabloid index page."""
10 changefreq = "monthly"
12 def items(self):
13 """Return the index url name."""
14 return ["thabloid:index"]
16 def location(self, item):
17 """Return the index url."""
18 return reverse(item)
21class ThabloidSitemap(sitemaps.Sitemap):
22 """Sitemap of the thabloid pages."""
24 changefreq = "never"
26 def items(self):
27 """Return all Thabloids."""
28 return Thabloid.objects.all()
30 def location(self, item):
31 """Return the url of a Thabloid."""
32 return item.get_absolute_url()
35sitemap = {
36 "thabloid-static": StaticViewSitemap,
37 "thabloid-thabloids": ThabloidSitemap,
38}