diff options
-rw-r--r-- | package-lock.json | 39 | ||||
-rw-r--r-- | package.json | 1 | ||||
-rw-r--r-- | src/pages/feed.xml.js | 20 |
3 files changed, 60 insertions, 0 deletions
diff --git a/package-lock.json b/package-lock.json index a5ced28..0c4e578 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "0.0.1", "dependencies": { "@astrojs/check": "^0.9.3", + "@astrojs/rss": "^4.0.7", "astro": "^4.15.2", "typescript": "^5.5.4" }, @@ -141,6 +142,16 @@ "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": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/@astrojs/telemetry/-/telemetry-3.1.0.tgz", @@ -2852,6 +2863,28 @@ "integrity": "sha512-MWipKbbYiYI0UC7cl8m/i/IWTqfC8YXsqjzybjddLsFjStroQzsHXkc73JutMvBiXmOvapk+axIl79ig5t55Bw==", "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": { "version": "1.17.1", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz", @@ -5423,6 +5456,12 @@ "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": { "version": "2.5.3", "resolved": "https://registry.npmjs.org/suf-log/-/suf-log-2.5.3.tgz", diff --git a/package.json b/package.json index 268aeb9..3d979c2 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ }, "dependencies": { "@astrojs/check": "^0.9.3", + "@astrojs/rss": "^4.0.7", "astro": "^4.15.2", "typescript": "^5.5.4" }, diff --git a/src/pages/feed.xml.js b/src/pages/feed.xml.js new file mode 100644 index 0000000..0fcc82f --- /dev/null +++ b/src/pages/feed.xml.js @@ -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 Popov’s Technology Blog", + }); +} |