adding rss flow

This commit is contained in:
2026-05-26 10:47:42 +02:00
parent 5d234e2e86
commit 2a5578a28a
4 changed files with 94 additions and 10 deletions
+40
View File
@@ -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 });
}
}
+4 -8
View File
@@ -11,14 +11,10 @@
"id": "224cf476c7b474e6", "id": "224cf476c7b474e6",
"type": "leaf", "type": "leaf",
"state": { "state": {
"type": "markdown", "type": "empty",
"state": { "state": {},
"file": "blog/fr/03-Deploying-an-infrastructure-for-a-macos-app-distribution.mdx",
"mode": "source",
"source": false
},
"icon": "lucide-file", "icon": "lucide-file",
"title": "03-Deploying-an-infrastructure-for-a-macos-app-distribution" "title": "Nouvel onglet"
} }
} }
] ]
@@ -196,8 +192,8 @@
}, },
"active": "224cf476c7b474e6", "active": "224cf476c7b474e6",
"lastOpenFiles": [ "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/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/02-Claude-Design-vs-Figma-Make.mdx",
"blog/fr/01-How-I-built-my-new-website-and-why.mdx", "blog/fr/01-How-I-built-my-new-website-and-why.mdx",
"blog/fr/02.mdx", "blog/fr/02.mdx",
+47 -1
View File
@@ -17,13 +17,15 @@
"next-mdx-remote": "^6.0.0", "next-mdx-remote": "^6.0.0",
"react": "19.2.4", "react": "19.2.4",
"react-dom": "19.2.4", "react-dom": "19.2.4",
"react-icons": "^5.6.0" "react-icons": "^5.6.0",
"rss": "^1.2.2"
}, },
"devDependencies": { "devDependencies": {
"@tailwindcss/postcss": "^4", "@tailwindcss/postcss": "^4",
"@types/node": "^20", "@types/node": "^20",
"@types/react": "^19", "@types/react": "^19",
"@types/react-dom": "^19", "@types/react-dom": "^19",
"@types/rss": "^0.0.32",
"eslint": "^9", "eslint": "^9",
"eslint-config-next": "16.2.3", "eslint-config-next": "16.2.3",
"tailwindcss": "^4", "tailwindcss": "^4",
@@ -2540,6 +2542,13 @@
"@types/react": "^19.2.0" "@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": { "node_modules/@types/trusted-types": {
"version": "2.0.7", "version": "2.0.7",
"resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz",
@@ -7901,6 +7910,27 @@
"node": ">=8.6" "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": { "node_modules/minimatch": {
"version": "3.1.5", "version": "3.1.5",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz",
@@ -8886,6 +8916,16 @@
"points-on-path": "^0.2.1" "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": { "node_modules/run-parallel": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",
@@ -10201,6 +10241,12 @@
"node": ">=0.10.0" "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": { "node_modules/yallist": {
"version": "3.1.1", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
+3 -1
View File
@@ -18,13 +18,15 @@
"next-mdx-remote": "^6.0.0", "next-mdx-remote": "^6.0.0",
"react": "19.2.4", "react": "19.2.4",
"react-dom": "19.2.4", "react-dom": "19.2.4",
"react-icons": "^5.6.0" "react-icons": "^5.6.0",
"rss": "^1.2.2"
}, },
"devDependencies": { "devDependencies": {
"@tailwindcss/postcss": "^4", "@tailwindcss/postcss": "^4",
"@types/node": "^20", "@types/node": "^20",
"@types/react": "^19", "@types/react": "^19",
"@types/react-dom": "^19", "@types/react-dom": "^19",
"@types/rss": "^0.0.32",
"eslint": "^9", "eslint": "^9",
"eslint-config-next": "16.2.3", "eslint-config-next": "16.2.3",
"tailwindcss": "^4", "tailwindcss": "^4",