made rss feed

+3 -1
astro.config.mjs
··· 2 2 import { defineConfig } from "astro/config"; 3 3 4 4 // https://astro.build/config 5 - export default defineConfig({}); 5 + export default defineConfig({ 6 + site: "https://entomoviscera.online", 7 + });
+41
package-lock.json
··· 8 8 "name": "personal-site", 9 9 "version": "0.0.1", 10 10 "dependencies": { 11 + "@astrojs/rss": "^4.0.13", 11 12 "astro": "^5.15.1" 12 13 }, 13 14 "devDependencies": { ··· 66 67 }, 67 68 "engines": { 68 69 "node": "18.20.8 || ^20.3.0 || >=22.0.0" 70 + } 71 + }, 72 + "node_modules/@astrojs/rss": { 73 + "version": "4.0.13", 74 + "resolved": "https://registry.npmjs.org/@astrojs/rss/-/rss-4.0.13.tgz", 75 + "integrity": "sha512-ugW4DmGn8kgfl8/qecU3EcKCAuEBrZqY7eYfa6at0sY7HGEwRdzsOafLE437RwDMP2ZuxfKnCNABs99YVhX0kg==", 76 + "license": "MIT", 77 + "dependencies": { 78 + "fast-xml-parser": "^5.3.0", 79 + "picocolors": "^1.1.1" 69 80 } 70 81 }, 71 82 "node_modules/@astrojs/telemetry": { ··· 2190 2201 "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", 2191 2202 "license": "MIT" 2192 2203 }, 2204 + "node_modules/fast-xml-parser": { 2205 + "version": "5.3.0", 2206 + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.3.0.tgz", 2207 + "integrity": "sha512-gkWGshjYcQCF+6qtlrqBqELqNqnt4CxruY6UVAWWnqb3DQ6qaNFEIKqzYep1XzHLM/QtrHVCxyPOtTk4LTQ7Aw==", 2208 + "funding": [ 2209 + { 2210 + "type": "github", 2211 + "url": "https://github.com/sponsors/NaturalIntelligence" 2212 + } 2213 + ], 2214 + "license": "MIT", 2215 + "dependencies": { 2216 + "strnum": "^2.1.0" 2217 + }, 2218 + "bin": { 2219 + "fxparser": "src/cli/cli.js" 2220 + } 2221 + }, 2193 2222 "node_modules/fdir": { 2194 2223 "version": "6.5.0", 2195 2224 "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", ··· 4218 4247 "funding": { 4219 4248 "url": "https://github.com/chalk/strip-ansi?sponsor=1" 4220 4249 } 4250 + }, 4251 + "node_modules/strnum": { 4252 + "version": "2.1.1", 4253 + "resolved": "https://registry.npmjs.org/strnum/-/strnum-2.1.1.tgz", 4254 + "integrity": "sha512-7ZvoFTiCnGxBtDqJ//Cu6fWtZtc7Y3x+QOirG15wztbdngGSkht27o2pyGWrVy0b4WAy3jbKmnoK6g5VlVNUUw==", 4255 + "funding": [ 4256 + { 4257 + "type": "github", 4258 + "url": "https://github.com/sponsors/NaturalIntelligence" 4259 + } 4260 + ], 4261 + "license": "MIT" 4221 4262 }, 4222 4263 "node_modules/suf-log": { 4223 4264 "version": "2.5.3",
+1
package.json
··· 10 10 "cleanup": "prettier . --write" 11 11 }, 12 12 "dependencies": { 13 + "@astrojs/rss": "^4.0.13", 13 14 "astro": "^5.15.1" 14 15 }, 15 16 "devDependencies": {
+1
src/pages/home.astro
··· 37 37 time={`${post[0].data.pub.getFullYear()}-${post[0].data.pub.getMonth() + 1}-${post[0].data.pub.getDate()}`} 38 38 /> 39 39 <a href="/blog">View all posts</a> 40 + <a href="/rss.xml">RSS feed</a> 40 41 </div> 41 42 </main> 42 43 </div>
+17
src/pages/rss.xml.js
··· 1 + import rss from "@astrojs/rss"; 2 + import { getCollection } from "astro:content"; 3 + 4 + export async function GET(context) { 5 + const blog = await getCollection("blog"); 6 + return rss({ 7 + title: "ENTOMOVISCERA.ONLINE", 8 + description: "WARNING: Bug inside.", 9 + site: context.site, 10 + items: blog.map((post) => ({ 11 + title: post.data.title, 12 + description: post.data.bio, 13 + pubDate: post.data.pub, 14 + link: `/blog/${post.id}/`, 15 + })), 16 + }); 17 + }