From 03aafdc673e60b54f6a0efa1601ea079ac6ac230 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Math=C3=A9o=20GUILBERT?= Date: Tue, 26 May 2026 11:25:57 +0200 Subject: [PATCH] adding metadata to rss flow to make n8n read right proprieties --- app/rss.xml/route.ts | 65 +++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/app/rss.xml/route.ts b/app/rss.xml/route.ts index ef58a62..fc328bf 100644 --- a/app/rss.xml/route.ts +++ b/app/rss.xml/route.ts @@ -3,38 +3,41 @@ import RSS from 'rss'; import { getAllArticles } from '@/lib/blog/get-articles'; export async function GET() { - const siteUrl = 'https://matheoguilbert.fr'; - - const feed = new RSS({ - title: 'Macthéo Guilbert | Blog', - description: 'Développement web, UI/UX et automatisations.', - feed_url: `${siteUrl}/rss.xml`, - site_url: siteUrl, - language: 'fr', - pubDate: new Date(), - }); + const siteUrl = 'https://matheoguilbert.fr'; - try { - const articles = await getAllArticles('fr'); - - articles.forEach((article) => { - feed.item({ - title: article.title, - description: article.description, - url: `${siteUrl}/fr/blog/${article.slug}`, - guid: article.slug, - date: article.date, - }); + const feed = new RSS({ + title: 'Macthéo Guilbert | Blog', + description: 'Développement web, UI/UX et automatisations.', + feed_url: `${siteUrl}/rss.xml`, + site_url: siteUrl, + language: 'fr', + pubDate: new Date(), }); - return new NextResponse(feed.xml({ indent: true }), { - headers: { - 'Content-Type': 'application/xml; charset=utf-8', - 'Cache-Control': 'no-store, no-cache, must-revalidate, proxy-revalidate', - }, - }); - } catch (error) { - console.error('Erreur lors de la génération du flux RSS:', error); - return new NextResponse('Internal Server Error', { status: 500 }); - } + try { + const articles = await getAllArticles('fr'); + + articles.forEach((article) => { + feed.item({ + title: article.title, + description: article.description, + url: `${siteUrl}/fr/blog/${article.slug}`, + guid: article.slug, + date: article.date, + custom_elements: [ + { 'meta_description': article.description } + ], + }); + }); + + return new NextResponse(feed.xml({ indent: true }), { + headers: { + 'Content-Type': 'application/xml; charset=utf-8', + 'Cache-Control': 'no-store, no-cache, must-revalidate, proxy-revalidate', + }, + }); + } catch (error) { + console.error('Erreur lors de la génération du flux RSS:', error); + return new NextResponse('Internal Server Error', { status: 500 }); + } } \ No newline at end of file