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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user