diff --git a/src/app/articles/[slug]/ArticleDetailClient.tsx b/src/app/articles/[slug]/ArticleDetailClient.tsx
index e36d012..143e2f9 100644
--- a/src/app/articles/[slug]/ArticleDetailClient.tsx
+++ b/src/app/articles/[slug]/ArticleDetailClient.tsx
@@ -424,17 +424,6 @@ export default function ArticleDetailClient({ article, relatedArticles }: Articl
- {/* Newsletter Signup */}
-
-
Stay Updated
-
- Get the latest broadcast engineering news delivered to your inbox.
-
-
- Subscribe Free
-
-
-
{/* Sidebar ad stack — 300x600 + 300x250 rotating */}
diff --git a/src/lib/articles/legacy-source.ts b/src/lib/articles/legacy-source.ts
index ca6f878..7ca64d0 100644
--- a/src/lib/articles/legacy-source.ts
+++ b/src/lib/articles/legacy-source.ts
@@ -252,21 +252,42 @@ export async function getLegacyRelatedArticles(
category: string | null,
count: number,
): Promise {
- try {
- let q = client()
- .from("wp_imported_posts")
- .select(SELECT_COLS)
- .eq("status", "published")
- .neq("wp_slug", excludeSlug)
- .order("wp_published_at", { ascending: false })
- .limit(count);
- if (category) q = q.eq("category", category);
- const { data, error } = await q;
- if (error || !data) return [];
- return (data as ImportedPostRow[]).map((r) => rowToArticle(r));
- } catch {
- return [];
+ const collected: ImportedPostRow[] = [];
+ const seen = new Set([excludeSlug]);
+ // First pass: same category. Skip when no category recorded.
+ if (category) {
+ try {
+ const { data } = await client()
+ .from("wp_imported_posts")
+ .select(SELECT_COLS)
+ .eq("status", "published")
+ .eq("category", category)
+ .neq("wp_slug", excludeSlug)
+ .order("wp_published_at", { ascending: false })
+ .limit(count);
+ for (const row of (data as ImportedPostRow[] | null) || []) {
+ if (!seen.has(row.wp_slug)) { collected.push(row); seen.add(row.wp_slug); }
+ }
+ } catch {}
}
+ // Fallback: top up to `count` with the latest published, excluding what we
+ // already have. Handles tiny categories, orphan rows, and category=null.
+ if (collected.length < count) {
+ try {
+ const { data } = await client()
+ .from("wp_imported_posts")
+ .select(SELECT_COLS)
+ .eq("status", "published")
+ .neq("wp_slug", excludeSlug)
+ .order("wp_published_at", { ascending: false })
+ .limit(count + collected.length + 5);
+ for (const row of (data as ImportedPostRow[] | null) || []) {
+ if (collected.length >= count) break;
+ if (!seen.has(row.wp_slug)) { collected.push(row); seen.add(row.wp_slug); }
+ }
+ } catch {}
+ }
+ return collected.map((r) => rowToArticle(r));
}
export async function getLegacyArticlesBySection(