Added RSS

This commit is contained in:
Valentin Popov 2024-09-04 21:45:53 +00:00
parent 536956f0f3
commit 7770a0852c
Signed by: Valentin Popov
GPG Key ID: AE3CE523DAAA8401
3 changed files with 60 additions and 0 deletions

39
package-lock.json generated
View File

@ -9,6 +9,7 @@
"version": "0.0.1", "version": "0.0.1",
"dependencies": { "dependencies": {
"@astrojs/check": "^0.9.3", "@astrojs/check": "^0.9.3",
"@astrojs/rss": "^4.0.7",
"astro": "^4.15.2", "astro": "^4.15.2",
"typescript": "^5.5.4" "typescript": "^5.5.4"
}, },
@ -141,6 +142,16 @@
"node": "^18.17.1 || ^20.3.0 || >=21.0.0" "node": "^18.17.1 || ^20.3.0 || >=21.0.0"
} }
}, },
"node_modules/@astrojs/rss": {
"version": "4.0.7",
"resolved": "https://registry.npmjs.org/@astrojs/rss/-/rss-4.0.7.tgz",
"integrity": "sha512-ZEG55XFB19l+DplUvBISmz04UbjDtKliRO4Y5+ERRhAMjgCVVobEBNE6ZwWG1h6orWUocy4nfPihKXDyB73x9g==",
"license": "MIT",
"dependencies": {
"fast-xml-parser": "^4.4.0",
"kleur": "^4.1.5"
}
},
"node_modules/@astrojs/telemetry": { "node_modules/@astrojs/telemetry": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/@astrojs/telemetry/-/telemetry-3.1.0.tgz", "resolved": "https://registry.npmjs.org/@astrojs/telemetry/-/telemetry-3.1.0.tgz",
@ -2852,6 +2863,28 @@
"integrity": "sha512-MWipKbbYiYI0UC7cl8m/i/IWTqfC8YXsqjzybjddLsFjStroQzsHXkc73JutMvBiXmOvapk+axIl79ig5t55Bw==", "integrity": "sha512-MWipKbbYiYI0UC7cl8m/i/IWTqfC8YXsqjzybjddLsFjStroQzsHXkc73JutMvBiXmOvapk+axIl79ig5t55Bw==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/fast-xml-parser": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.5.0.tgz",
"integrity": "sha512-/PlTQCI96+fZMAOLMZK4CWG1ItCbfZ/0jx7UIJFChPNrx7tcEgerUgWbeieCM9MfHInUDyK8DWYZ+YrywDJuTg==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/NaturalIntelligence"
},
{
"type": "paypal",
"url": "https://paypal.me/naturalintelligence"
}
],
"license": "MIT",
"dependencies": {
"strnum": "^1.0.5"
},
"bin": {
"fxparser": "src/cli/cli.js"
}
},
"node_modules/fastq": { "node_modules/fastq": {
"version": "1.17.1", "version": "1.17.1",
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz",
@ -5423,6 +5456,12 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/strnum": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/strnum/-/strnum-1.0.5.tgz",
"integrity": "sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==",
"license": "MIT"
},
"node_modules/suf-log": { "node_modules/suf-log": {
"version": "2.5.3", "version": "2.5.3",
"resolved": "https://registry.npmjs.org/suf-log/-/suf-log-2.5.3.tgz", "resolved": "https://registry.npmjs.org/suf-log/-/suf-log-2.5.3.tgz",

View File

@ -12,6 +12,7 @@
}, },
"dependencies": { "dependencies": {
"@astrojs/check": "^0.9.3", "@astrojs/check": "^0.9.3",
"@astrojs/rss": "^4.0.7",
"astro": "^4.15.2", "astro": "^4.15.2",
"typescript": "^5.5.4" "typescript": "^5.5.4"
}, },

20
src/pages/feed.xml.js Normal file
View File

@ -0,0 +1,20 @@
import rss from "@astrojs/rss";
import { getCollection } from "astro:content";
export async function GET(context) {
const posts = await getCollection("blog");
return rss({
customData: `<language>ru-ru</language>`,
description: "Tech insights and coding best practices from an OpenSource enthusiast and ethical hacker.",
items: posts.map((post) => ({
customData: post.data.customData,
description: post.data.description,
link: `/blog/${post.slug}`,
pubDate: post.data.pubDate,
title: post.data.title,
})),
site: context.site,
title: "Valentin Popovs Technology Blog",
});
}