Add defensive checks to RSS/sitemap generation
Prevents crashes when malformed claim entries exist: - Skip undefined or incomplete claim objects - Log warnings for debugging - Allow build to continue despite data issues 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
a81a78fbf5
commit
63f28d45a7
|
|
@ -36,6 +36,12 @@ function generateRssFeed(): string {
|
||||||
|
|
||||||
// Add all claims pages automatically (sorted by date, newest first)
|
// Add all claims pages automatically (sorted by date, newest first)
|
||||||
SORTED_CLAIMS.forEach((claim) => {
|
SORTED_CLAIMS.forEach((claim) => {
|
||||||
|
// Skip undefined or malformed entries
|
||||||
|
if (!claim || !claim.claims || !claim.title || !claim.slug) {
|
||||||
|
console.warn('Skipping malformed claim entry:', claim);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const description = `${claim.claims.length} atomic claims about ${claim.description.toLowerCase()}.`;
|
const description = `${claim.claims.length} atomic claims about ${claim.description.toLowerCase()}.`;
|
||||||
|
|
||||||
xml += `
|
xml += `
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,12 @@ function generateSitemap(): string {
|
||||||
|
|
||||||
// Add all claims pages automatically
|
// Add all claims pages automatically
|
||||||
ALL_CLAIMS_DATA.forEach((claim) => {
|
ALL_CLAIMS_DATA.forEach((claim) => {
|
||||||
|
// Skip undefined or malformed entries
|
||||||
|
if (!claim || !claim.slug || !claim.date) {
|
||||||
|
console.warn('Skipping malformed claim entry in sitemap:', claim);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
xml += ` <url>
|
xml += ` <url>
|
||||||
<loc>${baseUrl}/claims-library/${claim.slug}</loc>
|
<loc>${baseUrl}/claims-library/${claim.slug}</loc>
|
||||||
<lastmod>${formatDate(claim.date)}</lastmod>
|
<lastmod>${formatDate(claim.date)}</lastmod>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue