delete sampleArticles seed; serve all sections from bb.wp_imported_posts (DB)
Eliminates 72 hardcoded rocket.new image refs in one shot. Section pages (/gear, /technology, /show-coverage, /news) now render from bb.wp_imported_posts via getLegacyArticlesBySection(section), which maps each non-news section to a curated tag set (e.g. gear -> Audio, Cameras, lighting, Blackmagic Design, monitoring; technology -> AI, Streaming, OTT, IP, Cloud, AV; show-coverage -> NAB, IBC, BroadcastAsia). Also: - src/lib/articles/types.ts: Article interface lifted out of the deleted seed file. Type-only consumers (NewsArticleDetailClient, ArticleDetailClient, legacy-source) re-imported from here. - /news (client component) now wrapped: server fetches articles from DB and passes to NewsPageClient. Filter UI unchanged. - generateStaticParams on /news/[slug] and /articles/[slug] no longer references seed slugs; pre-renders 50 most-recent imported slugs and relies on dynamicParams + revalidate=3600 for the rest. - sitemap.ts now sources article URLs from getLegacyRecentSitemapEntries() (up to 5000 most-recent imported posts). Default BASE_URL fallback updated from the rocket.new placeholder to bb-staging.onsethost.com. - src/app/api/ai/article-suggestions/route.ts now pulls candidates from the DB (top 100 recent news) and resolves AI-returned slugs via DB lookup if not in the candidate window. Inline rocket.new image refs in homepage components (ArticleFeed, FeaturedBento) are unchanged in this commit; those are inline seed arrays in the components, not imports of sampleArticles.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { MetadataRoute } from 'next';
|
||||
import { sampleArticles } from '@/lib/articles/sampleArticles';
|
||||
import { getLegacyRecentSitemapEntries } from '@/lib/articles/legacy-source';
|
||||
|
||||
const BASE_URL = process.env.NEXT_PUBLIC_SITE_URL || 'https://broadcastb5322.builtwithrocket.new';
|
||||
const BASE_URL = process.env.NEXT_PUBLIC_SITE_URL || 'https://bb-staging.onsethost.com';
|
||||
|
||||
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
|
||||
// Static pages
|
||||
@@ -23,13 +23,26 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
|
||||
{ url: `${BASE_URL}/terms`, lastModified: new Date(), changeFrequency: 'yearly', priority: 0.3 },
|
||||
];
|
||||
|
||||
// Dynamic article pages — all published articles
|
||||
const articlePages: MetadataRoute.Sitemap = sampleArticles.map((article) => ({
|
||||
url: `${BASE_URL}/articles/${article.slug}`,
|
||||
lastModified: new Date(article.date) || new Date(),
|
||||
changeFrequency: 'monthly' as const,
|
||||
priority: 0.7,
|
||||
}));
|
||||
// Dynamic article pages — sourced from bb.wp_imported_posts (DB).
|
||||
const articleEntries = await getLegacyRecentSitemapEntries(5000);
|
||||
const articlePages: MetadataRoute.Sitemap = articleEntries.flatMap(({ slug, date }) => {
|
||||
const lastModified = new Date(date);
|
||||
const safe = isNaN(lastModified.getTime()) ? new Date() : lastModified;
|
||||
return [
|
||||
{
|
||||
url: `${BASE_URL}/news/${slug}`,
|
||||
lastModified: safe,
|
||||
changeFrequency: 'monthly' as const,
|
||||
priority: 0.7,
|
||||
},
|
||||
{
|
||||
url: `${BASE_URL}/articles/${slug}`,
|
||||
lastModified: safe,
|
||||
changeFrequency: 'monthly' as const,
|
||||
priority: 0.6,
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
// Attempt to ping Google Search Console (fire-and-forget, non-blocking)
|
||||
const sitemapUrl = encodeURIComponent(`${BASE_URL}/sitemap.xml`);
|
||||
|
||||
Reference in New Issue
Block a user