From 2a5578a28a0b32eed59d867dfd834fa4b325d835 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Math=C3=A9o=20GUILBERT?= Date: Tue, 26 May 2026 10:47:42 +0200 Subject: [PATCH] adding rss flow --- app/rss.xml/route.ts | 40 ++++++++++++++++++++++++++ content/.obsidian/workspace.json | 12 +++----- package-lock.json | 48 +++++++++++++++++++++++++++++++- package.json | 4 ++- 4 files changed, 94 insertions(+), 10 deletions(-) create mode 100644 app/rss.xml/route.ts diff --git a/app/rss.xml/route.ts b/app/rss.xml/route.ts new file mode 100644 index 0000000..ef58a62 --- /dev/null +++ b/app/rss.xml/route.ts @@ -0,0 +1,40 @@ +import { NextResponse } from 'next/server'; +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(), + }); + + 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, + }); + }); + + 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 diff --git a/content/.obsidian/workspace.json b/content/.obsidian/workspace.json index 57e8e5f..830c024 100644 --- a/content/.obsidian/workspace.json +++ b/content/.obsidian/workspace.json @@ -11,14 +11,10 @@ "id": "224cf476c7b474e6", "type": "leaf", "state": { - "type": "markdown", - "state": { - "file": "blog/fr/03-Deploying-an-infrastructure-for-a-macos-app-distribution.mdx", - "mode": "source", - "source": false - }, + "type": "empty", + "state": {}, "icon": "lucide-file", - "title": "03-Deploying-an-infrastructure-for-a-macos-app-distribution" + "title": "Nouvel onglet" } } ] @@ -196,8 +192,8 @@ }, "active": "224cf476c7b474e6", "lastOpenFiles": [ - "blog/en/03-Deploying-an-infrastructure-for-a-macos-app-distribution.mdx", "blog/fr/03-Deploying-an-infrastructure-for-a-macos-app-distribution.mdx", + "blog/en/03-Deploying-an-infrastructure-for-a-macos-app-distribution.mdx", "blog/fr/02-Claude-Design-vs-Figma-Make.mdx", "blog/fr/01-How-I-built-my-new-website-and-why.mdx", "blog/fr/02.mdx", diff --git a/package-lock.json b/package-lock.json index 08748a3..0595db2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,13 +17,15 @@ "next-mdx-remote": "^6.0.0", "react": "19.2.4", "react-dom": "19.2.4", - "react-icons": "^5.6.0" + "react-icons": "^5.6.0", + "rss": "^1.2.2" }, "devDependencies": { "@tailwindcss/postcss": "^4", "@types/node": "^20", "@types/react": "^19", "@types/react-dom": "^19", + "@types/rss": "^0.0.32", "eslint": "^9", "eslint-config-next": "16.2.3", "tailwindcss": "^4", @@ -2540,6 +2542,13 @@ "@types/react": "^19.2.0" } }, + "node_modules/@types/rss": { + "version": "0.0.32", + "resolved": "https://registry.npmjs.org/@types/rss/-/rss-0.0.32.tgz", + "integrity": "sha512-2oKNqKyUY4RSdvl5eZR1n2Q9yvw3XTe3mQHsFPn9alaNBxfPnbXBtGP8R0SV8pK1PrVnLul0zx7izbm5/gF5Qw==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/trusted-types": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", @@ -7901,6 +7910,27 @@ "node": ">=8.6" } }, + "node_modules/mime-db": { + "version": "1.25.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.25.0.tgz", + "integrity": "sha512-5k547tI4Cy+Lddr/hdjNbBEWBwSl8EBc5aSdKvedav8DReADgWJzcYiktaRIw3GtGC1jjwldXtTzvqJZmtvC7w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.13", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.13.tgz", + "integrity": "sha512-ryBDp1Z/6X90UvjUK3RksH0IBPM137T7cmg4OgD5wQBojlAiUwuok0QeELkim/72EtcYuNlmbkrcGuxj3Kl0YQ==", + "license": "MIT", + "dependencies": { + "mime-db": "~1.25.0" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/minimatch": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", @@ -8886,6 +8916,16 @@ "points-on-path": "^0.2.1" } }, + "node_modules/rss": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/rss/-/rss-1.2.2.tgz", + "integrity": "sha512-xUhRTgslHeCBeHAqaWSbOYTydN2f0tAzNXvzh3stjz7QDhQMzdgHf3pfgNIngeytQflrFPfy6axHilTETr6gDg==", + "license": "MIT", + "dependencies": { + "mime-types": "2.1.13", + "xml": "1.0.1" + } + }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -10201,6 +10241,12 @@ "node": ">=0.10.0" } }, + "node_modules/xml": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/xml/-/xml-1.0.1.tgz", + "integrity": "sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw==", + "license": "MIT" + }, "node_modules/yallist": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", diff --git a/package.json b/package.json index c49034f..6fb979b 100644 --- a/package.json +++ b/package.json @@ -18,13 +18,15 @@ "next-mdx-remote": "^6.0.0", "react": "19.2.4", "react-dom": "19.2.4", - "react-icons": "^5.6.0" + "react-icons": "^5.6.0", + "rss": "^1.2.2" }, "devDependencies": { "@tailwindcss/postcss": "^4", "@types/node": "^20", "@types/react": "^19", "@types/react-dom": "^19", + "@types/rss": "^0.0.32", "eslint": "^9", "eslint-config-next": "16.2.3", "tailwindcss": "^4",