Coverage for website/documents/sitemaps.py: 93.75%

16 statements  

« 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 

3 

4from . import models 

5 

6 

7class StaticViewSitemap(sitemaps.Sitemap): 

8 """Sitemap for the static pages.""" 

9 

10 priority = 0.5 

11 changefreq = "daily" 

12 

13 def items(self): 

14 return ["documents:index"] 

15 

16 def location(self, item): 

17 return reverse(item) 

18 

19 

20class MiscellaneousDocumentsSitemap(sitemaps.Sitemap): 

21 """Sitemap for misc documents.""" 

22 

23 def items(self): 

24 return models.MiscellaneousDocument.objects.exclude(members_only=True) 

25 

26 def location(self, item): 

27 return item.get_absolute_url() 

28 

29 

30sitemap = { 

31 "documents-static": StaticViewSitemap, 

32 "documents-miscellaneous": MiscellaneousDocumentsSitemap, 

33}