Skip to content

feat(citations): per-URL detail page — cited-in answers, prompt breakdown, owned-URL bridges - #556

Merged
gkhngyk merged 1 commit into
mainfrom
feature/535-citation-url-detail
Jul 29, 2026
Merged

gkhngyk merged 1 commit into
mainfrom
feature/535-citation-url-detail

Conversation

@gkhngyk

@gkhngyk gkhngyk commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements #535: every cited URL now has its own detail page at /dashboard/citations/url?u=<encoded-url>, answering "what exactly is citing this page, for which prompts, and is it working for us?" on one screen.

New server action — getCitationUrlDetail in web/src/lib/actions/citations.ts: one URL-filtered pass over prompt_results using the same scanFilteredResults scan, filters and URL bucketing as the overview (the inline URL normalization was extracted into a shared normalizeCitationUrl helper so the two can never drift), plus, for brand-owned URLs, two bridge queries: prompts targeting the URL via prompt_target_urls (matched with the same loose host+path key as the cited-stats pipeline) and AI-referred visits from ai_traffic_logs. No schema change, no new RPC.

New page — header (favicon, title, clickable URL, category + article-type badges, add-as-competitor for third-party domains / "Owned" badge for brand domains), KPI strip (total citations, answers citing, distinct prompts, platforms, first/last seen), the shared citations filter bar (date/platform/region), a paginated (10/page) "Cited in" list — date, platform icon, prompt link, sentiment, brand-mentioned, and the citation's position in the answer ("Early · #2 of 7", ranked by the stored start index) — a prompts breakdown table, and the two owned-URL bridge cards.

Shared components extracted (used by both the overview and the new page, no behavior change):

Entry points — URL rows on the Citations page (carrying the current filters) and the prompt detail Top Sources URLs tab both link to the detail page; the external-site link stays available as a small icon next to the title.

Related issue

Closes #535

Type of change

  • feat — New feature

How to test

  1. Citations → Sources by URL → click a row title: the detail page opens with the same date/platform/region filters; the KPI counts match the row's numbers for the same window.
  2. Change the filter bar on the detail page — all sections rescope together.
  3. The "Cited in" list pages 10 at a time; prompt links navigate to the prompt detail page.
  4. Open a brand-domain URL (Own domain only filter helps find one): an "Owned" badge replaces add-as-competitor and the "Targeted in prompts" / "AI-referred visits" cards render; both stay hidden for third-party URLs.
  5. Prompt detail → Top Sources → URLs tab: row titles link to the detail page.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/)
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

@gkhngyk
gkhngyk merged commit b1eaa85 into main Jul 29, 2026
5 checks passed
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.

Citations: per-URL detail page (cited-in answers, prompt breakdown, owned-URL bridges)

1 participant