Source code for education.sitemaps

"""The sitemaps defined by the education package"""
from django.contrib import sitemaps
from django.urls import reverse

from . import models


[docs]class StaticViewSitemap(sitemaps.Sitemap): """Sitemap of the static pages""" changefreq = "daily" priority = 0.5
[docs] def items(self): return ["education:books", "education:courses"]
[docs] def location(self, item): return reverse(item)
[docs]class CourseSitemap(sitemaps.Sitemap): """Sitemap of the course pages"""
[docs] def items(self): return models.Course.objects.all()
[docs] def location(self, item): return item.get_absolute_url()
sitemap = { "education-static": StaticViewSitemap, "education-courses": CourseSitemap, }