Skip to content

✨ Tag page lists every node kind (issues, solutions, case studies)#99

Merged
mathix420 merged 2 commits into
masterfrom
rework-/tag/-page
Jul 13, 2026
Merged

✨ Tag page lists every node kind (issues, solutions, case studies)#99
mathix420 merged 2 commits into
masterfrom
rework-/tag/-page

Conversation

@mathix420

Copy link
Copy Markdown
Owner

Problem

The /tag/[slug] page called /api/issues, which only returns top-level issues. So a tag's page showed a handful of nodes while the topics-index badge counted every tagged issue and solution — e.g. #circular-economy showed 17 on /tags but "Found 2 issues" on its own page.

Change

New endpoint server/api/tag/[slug].get.ts

  • Returns all approved, non-spam issues + solutions carrying the tag (both live in the issues table).
  • Plus case studies transitively: any study attached to a solution that carries the tag (case studies have no tags of their own). Uses the case-study search_vector, so search filters them too.
  • Singular path mirrors the existing /api/issues/api/issue/[id] convention and avoids a typed-route union collision with /api/tags/similar.

Page app/pages/tag/[slug].vue

  • Three labelled sections — Issues / Solutions / Case studies — with per-kind counts and a total. CardIssue for issues/solutions, CardCaseStudy for studies. Reuses UiSearchAndSortBar / UiSectionTitle / UiEmptyState; related-tags cloud now aggregates across all returned nodes.

Badge consistency server/api/tags.get.ts

  • The uses badge now also counts those transitive case studies, so it equals the page total again (distinct counts, since the case-study join multiplies solution rows).

Verification (against local dev DB)

  • climate: badge 27 = page total 27 (17 issues incl. 14 sub-issues + 10 solutions).
  • Temporarily approved one pending case study on a tagged solution → badge 27→28 and page total 27→28 stayed equal; search matched the study; the Case studies section rendered. Reverted the DB change.
  • Search / sort (newest, oldest, most_voted) / unknown-tag empty state all work.
  • bunx vue-tsc --noEmit clean; lint shows only warnings identical to the shipped solutions.vue / case-studies.vue (accepted project style). Added aria-labels to the sections.

🤖 Generated with Claude Code

The /tag/[slug] page called /api/issues, which only returns top-level
issues, so a tag's page showed a handful of nodes while the topics index
badge counted every tagged issue and solution (e.g. "17" vs "Found 2").

Add /api/tag/[slug]: returns all approved, non-spam issues and solutions
carrying the tag, plus the case studies attached to any tagged solution
(case studies have no tags of their own, so they surface transitively).
Filters match /api/tags. The page now groups results into Issues,
Solutions, and Case studies sections with per-kind counts.

Extend the /api/tags `uses` badge to also count those transitive case
studies so the badge equals the page total again.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown

🧹 Code quality

Check Summary
vize lint 0 errors · 319 warnings
vize format all files formatted
fallow audit pass · 0 dead-code · 0 complexity · 0 dupes (7 files)

updated for 5aed202 · run #281

CI's code-quality job failed on the previous commit: the page template
was unformatted, and fallow flagged both new units as introduced
complexity (0% estimated coverage puts the CRAP ceiling at cyclomatic 5).

- Format app/pages/tag/[slug].vue per vize.
- Endpoint: extract listParams / taggedNodeIds / tagIssueNodes /
  tagCaseStudies / caseStudyOrder helpers and fetch the two lists in
  parallel, dropping the handler well under the complexity threshold.
- Page: move pluralization, the count breakdown, the related-tag size
  class, and the section config into computeds; collapse the two
  identical node sections into one v-for. The remaining template
  branching is irreducible list-rendering, so suppress it with
  fallow-ignore-next-line (the diff-gate re-attributes the whole touched
  template as introduced), mirroring the case-study pages.

Behavior unchanged: re-verified nodes, transitive case studies, badge
parity, search and sort against the dev DB.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mathix420
mathix420 merged commit 76df6d5 into master Jul 13, 2026
6 checks passed
@mathix420
mathix420 deleted the rework-/tag/-page branch July 13, 2026 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant