Faceted tag filter on category pages

Faceted tag filter on category pages

#25 in Riparion/riparion-cms — merged 2026-06-01

Summary

  • Picking a tag inside /category/:slug now narrows results within that category instead of switching to the global tag feed.
  • The sidebar tag list is scoped to tags that actually appear on published posts in the category — it can no longer expand the visible set.
  • New list_tags_for_category server fn does a DISTINCT join over tags/post_tags/posts/categories (published-only).
  • Route is now /category/:slug?:tag; CategoryFeed reads the query and passes it through PaginatedFeed + the title. TagList/TagPill take an optional category_slug and toggle the active pill off on click. Outside a category, behavior is unchanged.
  • Breadcrumb shows a #tag crumb under the category when a facet is active; clicking the category clears it.

Test plan

  • dx serve, visit /category/foo — sidebar shows only tags present on foo's published posts.
  • Click a tag — URL becomes /category/foo?tag=…, feed narrows to the intersection, pill highlights.
  • Click the active pill — facet clears, full category feed returns.
  • Click the category name in the breadcrumb while faceted — same as above.
  • Visit /tag/:slug — sidebar still global; pill links still go to the global tag feed.
  • Visit /TagList continues to show all tags and link to global tag feeds.

Last updated 2026-06-02