Telling Search Engines What Exists, One Page at a Time
core/sitemaps.py is five small Sitemap classes and one hard rule: nothing the review gate would 404 gets advertised, because a crawler sent to collect 404s learns to trust the sitemap less.
A sitemap is a promise. Every URL in it tells a crawler "this page exists, fetch it" — and a search engine that gets burned enough times on 404s from your sitemap starts trusting it less, which is a worse outcome than not having a sitemap at all. core/sitemaps.py is built around that one rule more than around any SEO best practice.
QasidaSitemap, PoetSitemap, DedicationSitemap, CollectionSitemap, StaticSitemap — one review gate shared across all five.
The gate is not a display preference
Every qasida in this library passes through a review workflow — REVIEW_APPROVED is the state that lets a work show up on the public site at all. The sitemap only lists approved works:
class QasidaSitemap(Sitemap):
changefreq = 'monthly'
limit = 2000
def items(self):
return (Qasida.objects.approved()
.only('slug', 'title', 'created_at')
.order_by('-created_at'))That's stated as a deliberate design constraint, not an incidental filter: "the review gate is not a display preference: a page the site will not serve must not be advertised either." A crawler doesn't know or care why a page 404s — pending review, deleted, never existed — it just downgrades its trust in whatever handed it the URL.
Priority reflects usefulness, not just existence
QasidaSitemap.priority() isn't a flat constant. A work carrying a translation or a transliteration scores higher (0.8) than one holding only the original-script text (0.6):
def priority(self, obj):
return 0.8 if (obj.translation or obj.transliteration) else 0.6The reasoning: a reader arriving from a search engine, especially one searching in English, gets more use out of a work that has an accessible layer than one that's original-script only — so it's a reasonable signal to surface, even though priority is a fairly weak hint to search engines in practice.
lastmod measures editorial trust, not row mutation
def lastmod(self, obj):
return obj.reviewed_at or obj.created_atreviewed_at is when the text was last vouched for by a human, which is what a crawler deciding whether to re-fetch a page actually wants to know — not "when was any column in this row last touched," which updated_at would answer and which could be true after a purely internal bookkeeping change unrelated to the reader-facing content.
What's deliberately left out
StaticSitemap lists the handful of non-record pages — home, browse, poets, dedications, collections, categories, about, contribute, contact, privacy — but the comment on it is doing the real work:
def items(self):
# The contribution forms are deliberately absent: both need an account,
# so a crawler sent there collects a sign-in page wearing their titles.
return ['home', 'browse', 'poets', 'dedications', 'collections',
'categories', 'about', 'contribute', 'contact', 'privacy']A contribution page behind a login wall would still return 200 OK to a crawler — it just wouldn't return the content its title promises. That's a subtler trust violation than a 404: the page "exists" by HTTP status, but a search result pointing at it would mislead a reader clicking through from search, landing them on a sign-in prompt instead of the form they searched for.
PoetSitemap, DedicationSitemap, and CollectionSitemap all apply the same approved-only filter via distinct() over their reverse relation to Qasida, so a poet with zero approved works never gets a page listed either — consistent with the same underlying rule, applied at every level of the schema it touches.
Series: Qasida App.