diff --git a/prerender/seo/feeds.cjs b/prerender/seo/feeds.cjs
index 351ac57..78aa4ce 100644
--- a/prerender/seo/feeds.cjs
+++ b/prerender/seo/feeds.cjs
@@ -386,14 +386,7 @@ const generateProductsXml = (allProductsData = [], baseUrl, config) => {
return;
}
- // Clean description for feed (remove HTML tags and limit length)
- const rawDescription = product.description
- ? cleanTextContent(product.description).substring(0, 500)
- : `${product.name || 'Product'} - Art.-Nr.: ${product.articleNumber || 'N/A'}`;
-
- const cleanDescription = escapeXml(rawDescription) || "Produktbeschreibung nicht verfügbar";
-
- // Check if description is missing or too short (less than 20 characters)
+ // Check if description is missing or too short (less than 20 characters) - skip if insufficient
const originalDescription = product.description ? cleanTextContent(product.description) : '';
if (!originalDescription || originalDescription.length < 20) {
productsNeedingDescription.push({
@@ -402,8 +395,14 @@ const generateProductsXml = (allProductsData = [], baseUrl, config) => {
currentDescription: originalDescription || 'NONE',
url: `/Artikel/${product.seoName}`
});
+ skippedCount++;
+ return;
}
+ // Clean description for feed (remove HTML tags and limit length)
+ const rawDescription = cleanTextContent(product.description).substring(0, 500);
+ const cleanDescription = escapeXml(rawDescription) || "Produktbeschreibung nicht verfügbar";
+
// Clean product name
const rawName = product.name || "Unnamed Product";
const cleanName = escapeXml(cleanTextContent(rawName)) || "Unnamed Product";
@@ -487,19 +486,22 @@ const generateProductsXml = (allProductsData = [], baseUrl, config) => {
${gtin}`;
}
- // Add weight if available
- if (product.weight && !isNaN(product.weight)) {
- productsXml += `
- ${parseFloat(product.weight).toFixed(2)} g`;
- } else {
+ // Check if product has weight data - skip if missing
+ if (!product.weight || isNaN(product.weight)) {
// Track products without weight
productsNeedingWeight.push({
id: product.articleNumber || product.seoName,
name: product.name || 'Unnamed',
url: `/Artikel/${product.seoName}`
});
+ skippedCount++;
+ return;
}
+ // Add weight (we know it exists at this point)
+ productsXml += `
+ ${parseFloat(product.weight).toFixed(2)} g`;
+
// Add unit pricing data (required by German law for many products)
const unitPricingData = determineUnitPricingData(product);
if (unitPricingData.unit_pricing_measure) {