From c663e902ea1704cf642e42d214d69f98bd3fe5df Mon Sep 17 00:00:00 2001 From: sebseb7 Date: Fri, 18 Jul 2025 12:49:54 +0200 Subject: [PATCH] Implement product filtering based on excluded terms: Added logic to skip products with specific terms in their title or description during XML generation in feeds.cjs, enhancing content management for SEO purposes. --- prerender/seo/feeds.cjs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/prerender/seo/feeds.cjs b/prerender/seo/feeds.cjs index 3df07cf..b0ada0e 100644 --- a/prerender/seo/feeds.cjs +++ b/prerender/seo/feeds.cjs @@ -316,6 +316,27 @@ const generateProductsXml = (allProductsData = [], baseUrl, config) => { return; } + // Skip products with excluded terms in title or description + const productTitle = (product.name || "").toLowerCase(); + const productDescription = (product.description || "").toLowerCase(); + + const excludedTerms = { + title: ['canna', 'hash', 'marijuana'], + description: ['cannabis'] + }; + + // Check title for excluded terms + if (excludedTerms.title.some(term => productTitle.includes(term))) { + skippedCount++; + return; + } + + // Check description for excluded terms + if (excludedTerms.description.some(term => productDescription.includes(term))) { + skippedCount++; + return; + } + // Skip products without GTIN if (!product.gtin || !product.gtin.toString().trim()) { skippedCount++;