import inject from litestar import ( Controller, get, MediaType, ) from server.modules.descriptions import CharactersService, Breed class SeoController(Controller): @get("/sitemap.xml", media_type=MediaType.XML) async def sitemaps(self) -> bytes: characters_service: CharactersService = inject.instance(CharactersService) breeds: list[Breed] = await characters_service.get_characters() lastmod = "2025-10-04T19:01:03+00:00" beers_url = "" for b in breeds: beers_url += f""" https://xn-----6kcp3cadbabfh8a0a.xn--p1ai/dogs-characteristics/{b.alias} {lastmod} """ return f""" https://xn-----6kcp3cadbabfh8a0a.xn--p1ai/ {lastmod} https://xn-----6kcp3cadbabfh8a0a.xn--p1ai/cats {lastmod} https://xn-----6kcp3cadbabfh8a0a.xn--p1ai/donate {lastmod} https://xn-----6kcp3cadbabfh8a0a.xn--p1ai/dogs-characteristics {lastmod} {beers_url} """.encode() @get("/robots.txt", media_type=MediaType.TEXT) async def robots(self) -> str: return """ User-agent: * Allow: / Sitemap: https://xn-----6kcp3cadbabfh8a0a.xn--p1ai/sitemap.xml """