mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 08:29:01 +00:00
## Problem The Knowledge Base HTML pages show an "Updated" date, but their `.md` exports had no date. Readers and tools that use the markdown versions couldn't tell how recent a guide, FAQ, or troubleshooting article was. ## Solution Every Knowledge Base `.md` export now has a `Last updated: YYYY-MM-DD` line right under its title and description. It uses the date the HTML page shows. Guides and FAQs take it from the frontmatter `lastEdited`. Troubleshooting articles take it from the `troubleshooting_entries.date_updated` lookup the troubleshooting page already does, and fall back to frontmatter `lastEdited`. A page with no date gets no line. A failed database lookup logs a warning, and the export still builds. The export and the troubleshooting lookup share one date parser in `format-date.ts`. ## How to verify 1. Open a guide export on the preview, for example `/kb/guides/best-astro-authentication-providers.md`. Below the description it reads `Last updated: ` with the date from the HTML page's "Updated" label. 2. Open an FAQ `.md` export from `/kb/sitemap.md` and check that it has the same line. 3. Open a troubleshooting `.md` export from `/kb/sitemap.md`. If the HTML page shows an "Updated" date, the export shows the same day. 4. Run `pnpm --filter kb exec vitest run scripts/generate-markdown.test.ts src/lib/format-date.test.ts`. It covers the date line and the date parsing. ## Checks Ran `vitest run scripts/generate-markdown.test.ts src/lib/format-date.test.ts` in apps/kb (29 passed), `pnpm turbo run lint --filter=kb`, `tsc --noEmit -p apps/kb` (no errors in the changed files), and `oxfmt --check` on the changed files. Ran `tsx scripts/generate-markdown.ts` locally: every guide and FAQ export got the line, and the sitemap links are unchanged. A sample troubleshooting file with no database credentials fell back to its frontmatter date. The database lookup for troubleshooting wasn't run, because the sandbox has no credentials. ## Checklist - [x] I have read the [Contributing Guidelines](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) - [x] I have added tests for the change - [ ] I have checked that the change works in the preview deployment ## Feedback for Tedd To ask Tedd for a change to this PR, reply in Tedd's session on [DOCS-1838](https://linear.app/supabase/issue/DOCS-1838/add-last-modified-dates-to-md-versions-of-pages). Tedd doesn't read comments on this PR. --------- Co-authored-by: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com>