From 24b680576aeaac17ae6034fc313a6499cb8ec1a3 Mon Sep 17 00:00:00 2001 From: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> Date: Sun, 19 Oct 2025 14:07:52 +0200 Subject: [PATCH] Added static views to sitemap. --- djangoproject/sitemaps.py | 56 +++++++++++++++++++++++++++++++++++++++ djangoproject/tests.py | 7 +++++ djangoproject/urls/www.py | 3 +++ 3 files changed, 66 insertions(+) create mode 100644 djangoproject/sitemaps.py diff --git a/djangoproject/sitemaps.py b/djangoproject/sitemaps.py new file mode 100644 index 0000000000..4f1e9cd237 --- /dev/null +++ b/djangoproject/sitemaps.py @@ -0,0 +1,56 @@ +from dataclasses import dataclass + +from django.contrib import sitemaps +from django_hosts.resolvers import reverse + + +@dataclass +class URLObject: + name: str + host: str = "www" + + +class StaticViewSitemap(sitemaps.Sitemap): + priority = 0.5 + changefreq = "monthly" + + def items(self): + return [ + # accounts + URLObject("registration_register"), + # aggregator + URLObject("community-index"), + URLObject("community-ecosystem"), + URLObject("local-django-communities"), + # contact + URLObject("contact_foundation"), + # dashboard + URLObject("dashboard-index", host="dashboard"), + URLObject("metric-list", host="dashboard"), + # djangoproject + URLObject("homepage"), + URLObject("overview"), + URLObject("start"), + URLObject("code_of_conduct"), + URLObject("conduct_faq"), + URLObject("conduct_reporting"), + URLObject("conduct_enforcement"), + URLObject("conduct_changes"), + URLObject("diversity"), + URLObject("diversity_changes"), + # foundation + URLObject("foundation_meeting_archive_index"), + # fundraising + URLObject("fundraising:index"), + # members + URLObject("members:individual-members"), + URLObject("members:corporate-members"), + URLObject("members:corporate-members-join"), + URLObject("members:corporate-members-badges"), + URLObject("members:teams"), + # releases + URLObject("download"), + ] + + def location(self, item): + return reverse(item.name, host=item.host) diff --git a/djangoproject/tests.py b/djangoproject/tests.py index 127332bfdc..2033ad5920 100644 --- a/djangoproject/tests.py +++ b/djangoproject/tests.py @@ -196,6 +196,7 @@ def test_single_h1_per_page(self): "styleguide/", # Has multiple