diff --git a/src/ctfs/sitemaps.py b/src/ctfs/sitemaps.py new file mode 100644 index 0000000..8ba0136 --- /dev/null +++ b/src/ctfs/sitemaps.py @@ -0,0 +1,26 @@ +from django.contrib import sitemaps +from django.urls import reverse +from .models import Category, CTF +from .views import category, ctf + +class CategorySitemap(sitemaps.Sitemap): + changefreq = "weekly" + priority = 0.7 + i18n = True + + def items(self): + return Category.objects.all() + + def location(self, obj): + return reverse(category, kwargs={'cat_slug': obj.slug}) + +class CTFSitemap(sitemaps.Sitemap): + changefreq = "weekly" + priority = 0.7 + i18n = True + + def items(self): + return CTF.objects.all() + + def location(self, obj): + return reverse(ctf, kwargs={'cat_slug': obj.category.slug, 'ctf_slug': obj.slug}) \ No newline at end of file diff --git a/src/ctfs/templates/ctfs/ctf_info.html b/src/ctfs/templates/ctfs/ctf_info.html index 453697f..18eca46 100644 --- a/src/ctfs/templates/ctfs/ctf_info.html +++ b/src/ctfs/templates/ctfs/ctf_info.html @@ -8,7 +8,7 @@