homepage: All featured → goes to dedicated /news/featured page
Was linking to /news?category=Featured which silently fell back to the unfiltered /news listing because "Featured" isn't in CATEGORIES and the filter is tag-based, not category-column-based. Adds getLegacyFeaturedArticles() that mirrors FeaturedBento's query (category ILIKE 'featured', featured-flag-first sort) at limit 200, and a thin /news/featured route that reuses NewsPageClient.
This commit is contained in:
22
src/app/news/featured/page.tsx
Normal file
22
src/app/news/featured/page.tsx
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import type { Metadata } from "next";
|
||||||
|
import { Suspense } from "react";
|
||||||
|
import NewsPageClient from "../NewsPageClient";
|
||||||
|
import { getLegacyFeaturedArticles } from "@/lib/articles/legacy-source";
|
||||||
|
|
||||||
|
export const revalidate = 1800;
|
||||||
|
|
||||||
|
export const metadata: Metadata = {
|
||||||
|
title: "Featured Stories — Broadcast Beat",
|
||||||
|
description:
|
||||||
|
"Editorial picks from the Broadcast Beat staff — the most important industry stories, hand-selected from across broadcast engineering, IP/cloud workflows, streaming, AI, and live production.",
|
||||||
|
alternates: { canonical: "/news/featured" },
|
||||||
|
};
|
||||||
|
|
||||||
|
export default async function FeaturedNewsPage() {
|
||||||
|
const articles = await getLegacyFeaturedArticles(200);
|
||||||
|
return (
|
||||||
|
<Suspense fallback={null}>
|
||||||
|
<NewsPageClient articles={articles} />
|
||||||
|
</Suspense>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -66,7 +66,7 @@ export default async function FeaturedBento() {
|
|||||||
<div className="flex items-center gap-3 mb-4 md:mb-5 flex-wrap">
|
<div className="flex items-center gap-3 mb-4 md:mb-5 flex-wrap">
|
||||||
<span className="section-label">Staff Editorial</span>
|
<span className="section-label">Staff Editorial</span>
|
||||||
<div className="flex-1 h-px bg-[#2a2a2a]" />
|
<div className="flex-1 h-px bg-[#2a2a2a]" />
|
||||||
<Link href="/news?category=Featured" className="text-[11px] font-mono text-[var(--color-text-info,#60a5fa)] hover:underline whitespace-nowrap">
|
<Link href="/news/featured" className="text-[11px] font-mono text-[var(--color-text-info,#60a5fa)] hover:underline whitespace-nowrap">
|
||||||
All featured →
|
All featured →
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -317,6 +317,23 @@ export async function getLegacyArticlesBySection(
|
|||||||
return merged.slice(0, limit).map((m) => m.article);
|
return merged.slice(0, limit).map((m) => m.article);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getLegacyFeaturedArticles(limit = 200): Promise<Article[]> {
|
||||||
|
try {
|
||||||
|
const { data, error } = await client()
|
||||||
|
.from("wp_imported_posts")
|
||||||
|
.select(SELECT_COLS + ",featured")
|
||||||
|
.eq("status", "published")
|
||||||
|
.ilike("category", "featured")
|
||||||
|
.order("featured", { ascending: false })
|
||||||
|
.order("wp_published_at", { ascending: false, nullsFirst: false })
|
||||||
|
.limit(limit);
|
||||||
|
if (error || !data) return [];
|
||||||
|
return (data as ImportedPostRow[]).map((r) => rowToArticle(r));
|
||||||
|
} catch {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Default raised from 50 → 5000 because users expect search to return
|
// Default raised from 50 → 5000 because users expect search to return
|
||||||
// every match. The 29k-article archive is small enough that title/excerpt
|
// every match. The 29k-article archive is small enough that title/excerpt
|
||||||
// ilike filters stay fast even without an explicit cap. Pass a smaller
|
// ilike filters stay fast even without an explicit cap. Pass a smaller
|
||||||
|
|||||||
Reference in New Issue
Block a user