news/featured: broaden filter back to category=featured w/ pinned-first sort
featured=true alone only matches 1 row right now, which would leave the Featured Editorial page nearly empty. Broader category match keeps the page full while featured DESC still bubbles editorial pins to the top. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -340,15 +340,16 @@ export async function getLegacyArticlesBySection(
|
|||||||
|
|
||||||
export async function getLegacyFeaturedArticles(limit = 200): Promise<Article[]> {
|
export async function getLegacyFeaturedArticles(limit = 200): Promise<Article[]> {
|
||||||
try {
|
try {
|
||||||
// Strict mode: only rows the editorial team has explicitly pinned via
|
// Show every row in the Featured category, but bubble editorial pins
|
||||||
// wp_imported_posts.featured=true. The broader category='featured' pool
|
// (featured=true) to the top. Strict "featured=true only" filtering was
|
||||||
// also contains older PR-leaning items that should not surface on the
|
// tried briefly and left the page near-empty (1 row); the broader pool
|
||||||
// public Featured Editorial page.
|
// gives the page real depth while pins still lead.
|
||||||
const { data, error } = await client()
|
const { data, error } = await client()
|
||||||
.from("wp_imported_posts")
|
.from("wp_imported_posts")
|
||||||
.select(SELECT_COLS + ",featured")
|
.select(SELECT_COLS + ",featured")
|
||||||
.eq("status", "published")
|
.eq("status", "published")
|
||||||
.eq("featured", true)
|
.ilike("category", "featured")
|
||||||
|
.order("featured", { ascending: false })
|
||||||
.order("wp_published_at", { ascending: false, nullsFirst: false })
|
.order("wp_published_at", { ascending: false, nullsFirst: false })
|
||||||
.limit(limit);
|
.limit(limit);
|
||||||
if (error || !data) return [];
|
if (error || !data) return [];
|
||||||
|
|||||||
Reference in New Issue
Block a user