Coverage for website/thaliawebsite/sitemaps.py: 100.00%

7 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 

4 

5class StaticViewSitemap(sitemaps.Sitemap): 

6 """Sitemap items for static pages.""" 

7 

8 def items(self): 

9 """Return items of the site map. 

10 

11 >>> sitemap = StaticViewSitemap() 

12 >>> sitemap.items()[0] 

13 'index' 

14 

15 :return: the items in the site map 

16 :rtype: [str] 

17 """ 

18 # Need to be valid entries for reverse() 

19 return ["index"] 

20 

21 def location(self, item): 

22 """Get the location for a site map item. 

23 

24 Example:: 

25 

26 >>> sitemap = StaticViewSitemap() 

27 >>> sitemap.location('index') 

28 '/' 

29 

30 :param item: the item to reverse. 

31 :type item: str 

32 :return: the URI to the item. 

33 """ 

34 return reverse(item)