diff --git a/docs/specs/20260425-tags-page.md b/docs/specs/20260425-tags-page.md new file mode 100644 index 00000000..f0285dc6 --- /dev/null +++ b/docs/specs/20260425-tags-page.md @@ -0,0 +1,247 @@ +# Spec: Tag pages and tags index + +## Goal + +Make tag buttons on every page navigate to a paginated listing of pages sharing +that tag, and add an index page that lists all tags. Tag links currently target +`/tags/` (built in `factory.ts:179`) but no route handles them, so they +404 and the buttons are rendered with `disabled={true}`. Activate the links and +build the destination. + +## Scope + +In scope: + +- New route `/tags/[slug]` — paginated listing of pages tagged ``. +- New route `/tags` — index of all tags ordered by page count. +- Activation of tag buttons in `TagList` (drop `disabled={true}`). +- Sitemap entries for both new route shapes. +- Unit tests for new factory and pagination logic. + +Out of scope: + +- Filtering or searching within a tag listing. +- Multi-tag intersection (`/tags/a+b` etc.). +- "Related tags" widget on a page. +- Editorial featuring of pages within a tag listing — when a `featured`/`starred` + field is added to PocketBase later, `createTagPageCards` is the one place to + flip `featured` from the source field. +- Russian collation niceties beyond `String#localeCompare("ru")` if a tiebreak + is ever needed. + +## Routes + +### `/tags/[slug]?page=N` + +- Pages tagged with ``, sorted by PocketBase `updated` desc. +- 24 items per page. +- Page 1 statically generated via `generateStaticParams` (one entry per tag + slug); pages 2..N rendered on demand and cached by ISR (`revalidate = 30`). + Next.js `generateStaticParams` does not accept search params. +- Renders `` with breadcrumb `Главная → Метки →