Skip to content

feat(explore): list articles carrying the tag, not only posts - #148

Merged
aquie00t merged 1 commit into
mainfrom
feature/explore-tag-articles
Aug 30, 2026
Merged

feat(explore): list articles carrying the tag, not only posts#148
aquie00t merged 1 commit into
mainfrom
feature/explore-tag-articles

Conversation

@aquie00t

Copy link
Copy Markdown
Contributor

Summary

A tag is not a post-only idea. GET /articles?tag=nodejs&page=1&limit=10 narrows articles the same way GET /posts?tag= narrows posts — but /explore?tag=nodejs only ever asked for posts, so an author who tagged an article nodejs never saw it under #nodejs.

The tag view now carries the same Posts / Articles strip the profile does, and each list fetches only while its own tab is showing, so opening Articles does not refetch the posts behind it. articleApi.getArticles already took tag — no API-layer change was needed.

Which tab is open lives in the query string beside the tag, so /explore?tag=nodejs&tab=articles is a link someone can send. posts is the default and is left out of the URL, so the plain /explore?tag=nodejs already shared around still opens on posts, and an unknown slug falls back to Posts rather than an empty page. Switching replaces the entry rather than pushing one — Back here is for leaving the tag, not for walking back through which of its two lists was looked at last.

Also fixed along the way: the tag view was passing hasMore={false} and an empty onLoadMore to PostList, so a tag stopped at its first page however many pages the endpoint had. Both lists now get the pagination the hooks already provided.

New i18n key explore.articlesTaggedSubtitle (en + tr) so the subtitle says which of the two it is counting.

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Dependency update
  • Documentation

How was this tested?

pnpm exec tsc -b clean
pnpm lint clean
pnpm test 616 / 616 passing (74 files)
explore-tags.spec + articles.spec + profile.spec 13 / 13 passing

New coverage:

  • src/pages/ExplorePage.test.tsx (9 tests, the page had none) — the tab the URL names, the fallback for an unknown slug, fetchArticles({ tag }) on the Articles tab with no second posts fetch behind it, the default tab dropping back out of the URL, REPLACE rather than a pushed entry, the subtitle switching, and the trending view fetching nothing.
  • e2e/explore-tags.spec.ts — a real round trip proving tag=nodejs reaches /articles, that ?tab=articles opens on articles without fetching posts at all, and that Back leaves the tag rather than the tab.

docs/QA.md updated with the ExplorePage section and both new specs.

Screenshots (if applicable)

The strip is the profile's markup unchanged (flex-1 buttons, 2px underline on the active one), sitting under the #tag header inside the existing sticky bar.

Checklist

  • pnpm lint passes
  • pnpm exec tsc -b passes (no type errors)
  • Tested on mobile viewport (or N/A) — the strip is full-width flex-1, same as the profile's
  • No new any types introduced
  • No console.log left in code
  • SEO / OG meta not regressed (if UI change)

One thing noticed, not changed

useTrends does setTrends(data.trends) with no fallback (src/features/trends/hooks/useTrends.ts). A /tags/trends body without a trends key leaves the state undefined and TrendingTopicsWidget then throws on trends.length — which takes down the whole route, on every page, since the widget is in the right rail everywhere. I hit it with a malformed stub rather than from the real API, and fixing it is outside this change; flagging it as worth a one-line guard.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MyKUa9kaZDJbC7D1j7w2Fs

A tag is not a post-only idea. GET /articles?tag= narrows articles the
same way GET /posts?tag= narrows posts, but /explore?tag=nodejs only ever
asked for posts, so an author who tagged an article nodejs never saw it
under #nodejs.

The tag view now carries the same Posts / Articles strip the profile does,
and each list fetches only while its own tab is showing. Which tab is open
lives in the query string beside the tag, so /explore?tag=nodejs&tab=articles
is a link someone can send; posts is the default and stays out of the URL,
leaving the plain /explore?tag=nodejs already shared around unchanged.
Switching replaces the entry rather than pushing one, because Back here is
for leaving the tag.

Both lists also get the pagination they already supported: the tag view was
passing hasMore={false} and an empty onLoadMore, so a tag stopped at its
first page however many pages the endpoint had.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MyKUa9kaZDJbC7D1j7w2Fs
@cloudflare-workers-and-pages

Copy link
Copy Markdown
Contributor

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
tdn-client f7f1b1b Commit Preview URL

Branch Preview URL
Aug 30 2026, 04:53 AM

@aquie00t
aquie00t merged commit 3000f7e into main Aug 30, 2026
7 of 8 checks passed
@aquie00t
aquie00t deleted the feature/explore-tag-articles branch August 30, 2026 05:23
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