Source code for thaliawebsite.sitemaps
"""Defines site maps."""
from django.contrib import sitemaps
from django.urls import reverse
[docs]class StaticViewSitemap(sitemaps.Sitemap):
"""Sitemap items for static pages"""
[docs] def items(self):
"""
The items of the site map.
>>> sitemap = StaticViewSitemap()
>>> sitemap.items()[0]
'index'
:return: the items in the site map
:rtype: [str]
"""
# Need to be valid entries for reverse()
return ["index"]
[docs] def location(self, obj):
"""
Get the location for a site map item.
Example::
>>> sitemap = StaticViewSitemap()
>>> sitemap.location('index')
'/'
:param obj: the item to reverse.
:type obj: str
:return: the URI to the item.
"""
return reverse(obj)