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:
Ryan Salazar
2026-05-26 19:24:18 +00:00
parent 4ec3e48c62
commit 8c4721bcbd
3 changed files with 40 additions and 1 deletions

View File

@@ -317,6 +317,23 @@ export async function getLegacyArticlesBySection(
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
// every match. The 29k-article archive is small enough that title/excerpt
// ilike filters stay fast even without an explicit cap. Pass a smaller