Source code for thabloid.sitemaps

from django.contrib import sitemaps
from django.urls import reverse

from . import models


[docs]class StaticViewSitemap(sitemaps.Sitemap): """Sitemap of the static thabloid index page.""" changefreq = "monthly"
[docs] def items(self): """Return the index url name.""" return ["thabloid:index"]
[docs] def location(self, obj): """Return the index url.""" return reverse(obj)
[docs]class ThabloidSitemap(sitemaps.Sitemap): """Sitemap of the thabloid pages.""" changefreq = "never"
[docs] def items(self): """Return all Thabloids.""" return models.Thabloid.objects.all()
[docs] def location(self, obj): """Return the url of a Thabloid.""" return obj.get_absolute_url()
sitemap = { "thabloid-static": StaticViewSitemap, "thabloid-thabloids": ThabloidSitemap, }