Add sitemaps

This commit is contained in:
Joakim Hellsén 2024-02-23 14:43:32 +01:00
commit 5bb0801f15
4 changed files with 47 additions and 3 deletions

18
feeds/sitemaps.py Normal file
View file

@ -0,0 +1,18 @@
from __future__ import annotations
from django.contrib.sitemaps import Sitemap
from django.urls import reverse
class StaticViewSitemap(Sitemap):
"""Sitemap for static views."""
changefreq: str = "daily"
priority: float = 0.5
def items(self: StaticViewSitemap) -> list[str]:
"""Return all the items in the sitemap."""
return ["feeds:index", "feeds:feeds", "feeds:domains"]
def location(self, item) -> str:
return reverse(item)