diff --git a/app/(marketing)/trending/page.tsx b/app/(marketing)/trending/page.tsx
index 9fb8228..92e2ac4 100644
--- a/app/(marketing)/trending/page.tsx
+++ b/app/(marketing)/trending/page.tsx
@@ -1,6 +1,7 @@
import Link from "next/link";
import { serviceClient } from "@/lib/supabase/service";
import { currentTrends } from "@/lib/ads/trends";
+import { pitSearchUrl } from "@/lib/ads/trendList";
import { TREND_WINDOW_DAYS, trendsAreStale } from "@/lib/ads/trending";
export const metadata = {
@@ -80,7 +81,11 @@ export default async function TrendingPage() {
{topics.map((topic, index) => (
| {index + 1} |
- {topic.label ?? topic.topic} |
+
+
+ {topic.label ?? topic.topic}
+
+ |
{topic.mentions} |
{topic.priorMentions} |
{change(topic.mentions, topic.priorMentions)} |
diff --git a/lib/ads/trendList.ts b/lib/ads/trendList.ts
index 9dbbaec..44dcff8 100644
--- a/lib/ads/trendList.ts
+++ b/lib/ads/trendList.ts
@@ -5,6 +5,11 @@ import type { SupabaseClient } from "@supabase/supabase-js";
import { currentTrends } from "./trends";
import { TREND_MAX_AGE_HOURS, TREND_SOURCE, TREND_WINDOW_DAYS, trendsAreStale } from "./trending";
+/** Where a subject can be searched. */
+export function pitSearchUrl(subject: string): string {
+ return `https://pit.world/search?q=${encodeURIComponent(subject)}`;
+}
+
export async function publicTrendList(sb: SupabaseClient, options: { limit?: number; now?: number } = {}) {
const now = options.now ?? Date.now();
const limit = Math.min(200, Math.max(1, Math.round(Number(options.limit)) || 50));
@@ -26,6 +31,7 @@ export async function publicTrendList(sb: SupabaseClient, options: { limit?: num
score: signal.score,
feeds: signal.mentions,
prior_feeds: signal.priorMentions,
+ search_url: pitSearchUrl(signal.label ?? signal.topic),
})),
};
}
diff --git a/tests/ads-trend-list.test.ts b/tests/ads-trend-list.test.ts
index f766f17..edca158 100644
--- a/tests/ads-trend-list.test.ts
+++ b/tests/ads-trend-list.test.ts
@@ -29,7 +29,14 @@ describe("publicTrendList", () => {
const list = await publicTrendList(client([row("midterm result", "midterm results", "2026-11-07T11:00:00Z")]), { now: NOW });
expect(list.stale).toBe(false);
expect(list.topics).toEqual([
- { topic: "midterm results", match_key: "midterm result", score: 40, feeds: 60, prior_feeds: 2 },
+ {
+ topic: "midterm results",
+ match_key: "midterm result",
+ score: 40,
+ feeds: 60,
+ prior_feeds: 2,
+ search_url: "https://pit.world/search?q=midterm%20results",
+ },
]);
});