Files
supabase/apps/docs/lib
Miranda LimonczenkoandClaude 4d9726da1c feat(docs): add last-modified dates to the docs sitemap (#54329)
Closes DOCS-1753

## Problem

Guide pages already show a "Last updated" date
(supabase/supabase#52421), but `sitemap.xml` has no `<lastmod>`, so
crawlers get no recency signal.
## Solution

- Guide entries in `sitemap.xml` now include `<lastmod>`. The date comes
from the same `last_changed` table as the on-page date: the newest
`last_updated` across a page's sections, written as an ISO 8601
timestamp.
- The paginated `last_changed` read moved from `lib/last-changed.ts`
into `lib/last-changed.utils.ts`. The new module has no `server-only`
import, so the `tsx` sitemap script can share it. `getGuideLastUpdated`
behaves the same, including its timeout, cooldown, and Sentry reporting.
- When `NEXT_PUBLIC_SUPABASE_URL` or `SUPABASE_SECRET_KEY` is missing,
or the read fails, the script logs a warning and writes the sitemap
without `<lastmod>`. Local and preview builds still succeed.
- `build:sitemap` in `apps/docs/turbo.jsonc` is now uncached and passes
the two credentials through. The dates change nightly, outside the
task's inputs, so a cache hit could otherwise restore stale dates. The
task is cheap, and its dependencies stay cached.
- Reference pages don't get `<lastmod>` because `last_changed` only
tracks guides.
- `sitemap.md` (marked TBD in the issue) is out of scope.

## Review instructions

| Preview | Link |
| --- | --- |
| Docs sitemap |
https://docs-git-claude-compassionate-dirac-ns0vjr-supabase.vercel.app/docs/sitemap.xml
|
| Docs app |
https://docs-git-claude-compassionate-dirac-ns0vjr-supabase.vercel.app/docs
|

1. Check the `build:sitemap` step in the Vercel build log. It should
print `Total of N pages in sitemap (M with last-modified dates)`, where
M is greater than 0.
2. In the preview deploy, open `/docs/sitemap.xml` and confirm that
guide entries have `<lastmod>` values matching the "Last updated" date
on those pages.
3. Optional local check: run `pnpm -F docs build:sitemap` without
credentials. You should see the warning, and the sitemap should have no
`<lastmod>` entries.

Co-authored-by: Claude <noreply@anthropic.com>
2026-12-01 10:03:01 -08:00
..
2026-09-11 12:17:49 +08:00