First draft of rss feed

This commit is contained in:
Southpaw 2023-09-10 21:11:57 +01:00
parent 22208c412f
commit 345f40b489
Signed by: Southpaw1496
GPG Key ID: 6C8E5784D5563BFF
5 changed files with 71 additions and 11 deletions

View File

@ -15,6 +15,7 @@
"@astrojs/rss": "^1.2.1",
"@astrojs/sitemap": "^1.4.0",
"astro": "^3.0.2",
"astro-iconify": "^1.2.0"
"astro-iconify": "^1.2.0",
"markdown-it": "^13.0.1"
}
}

View File

@ -20,6 +20,9 @@ dependencies:
astro-iconify:
specifier: ^1.2.0
version: 1.2.0
markdown-it:
specifier: ^13.0.1
version: 13.0.1
packages:
@ -1628,6 +1631,11 @@ packages:
once: 1.4.0
dev: false
/entities@3.0.1:
resolution: {integrity: sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q==}
engines: {node: '>=0.12'}
dev: false
/entities@4.5.0:
resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==}
engines: {node: '>=0.12'}
@ -2328,6 +2336,12 @@ packages:
resolution: {integrity: sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ==}
dev: false
/linkify-it@4.0.1:
resolution: {integrity: sha512-C7bfi1UZmoj8+PQx22XyeXCuBlokoyWQL5pWSP+EI6nzRylyThouddufc2c1NDIcP9k5agmN9fLpA7VNJfIiqw==}
dependencies:
uc.micro: 1.0.6
dev: false
/load-yaml-file@0.2.0:
resolution: {integrity: sha512-OfCBkGEw4nN6JLtgRidPX6QxjBQGQf72q3si2uvqyFEMbycSFFHwAZeXx6cJgFM9wmLrf9zBwCP3Ivqa+LLZPw==}
engines: {node: '>=6'}
@ -2394,6 +2408,17 @@ packages:
engines: {node: '>=0.10.0'}
dev: false
/markdown-it@13.0.1:
resolution: {integrity: sha512-lTlxriVoy2criHP0JKRhO2VDG9c2ypWCsT237eDiLqi09rmbKoUetyGHq2uOIRoRS//kfoJckS0eUzzkDR+k2Q==}
hasBin: true
dependencies:
argparse: 2.0.1
entities: 3.0.1
linkify-it: 4.0.1
mdurl: 1.0.1
uc.micro: 1.0.6
dev: false
/markdown-table@3.0.3:
resolution: {integrity: sha512-Z1NL3Tb1M9wH4XESsCDEksWoKTdlUafKc4pt0GRwjUyXaCFZ+dc3g2erqB6zm3szA2IUSi7VnPI+o/9jnxh9hw==}
dev: false
@ -2600,6 +2625,10 @@ packages:
resolution: {integrity: sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==}
dev: false
/mdurl@1.0.1:
resolution: {integrity: sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==}
dev: false
/merge-stream@2.0.0:
resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==}
dev: false
@ -3919,6 +3948,10 @@ packages:
engines: {node: '>=12.20'}
dev: false
/uc.micro@1.0.6:
resolution: {integrity: sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==}
dev: false
/undici@5.23.0:
resolution: {integrity: sha512-1D7w+fvRsqlQ9GscLBwcAJinqcZGHUKjbOmXdlE/v8BvEGXjeWAax+341q44EuTcHXXnfyKNbKRq4Lg7OzhMmg==}
engines: {node: '>=14.0'}

View File

@ -0,0 +1,14 @@
---
title: "Hello World!"
description: "The first post."
image: "https://static.southpaw1496.me/blog/blogging-vs-blog-setups.jpg"
imageAlt: "A graph showing a bell curve of the number of blog posts vs the number of blog posts about elaborate blog setups."
tags: ["Ramblings"]
created: 2023-09-10
---
Hello World!
This blog is written with [Astro](https://astro.build) and hosted using [Cloudflare Pages](https://www.cloudflare.com/en-gb/developer-platform/pages/). Some day, I may write more about them.
There's also [an RSS feed]

View File

@ -44,7 +44,7 @@ const siteURL = SITE_TITLE + "/"
<time datetime={post.data.created.toISOString()}>
{post.data.created.toLocaleDateString()}
</time>
<a href={SITE_TITLE + "/blog/" + post.slug}>{post.data.title}</a>
<a href={"/blog/" + post.slug}>{post.data.title}</a>
{post.data.description}
</li>
))

View File

@ -1,10 +1,22 @@
import rss from '@astrojs/rss';
import { SITE_TITLE, SITE_DESCRIPTION } from '../config';
import rss from "@astrojs/rss";
import { getCollection } from "astro:content";
import MarkdownIT from "markdown-it"
export const get = () =>
rss({
title: SITE_TITLE,
description: SITE_DESCRIPTION,
site: import.meta.env.SITE,
items: import.meta.glob('./blog/**/*.{md,mdx}'),
});
const parser = new MarkdownIT()
export async function get() {
const posts = await getCollection('blog');
return rss({
title: 'Southpaw1496',
description: 'My Blog',
site: 'https://southpaw1496.me/blog',
items: posts.map((post) => ({
title: post.data.title,
pubDate: post.data.pubDate,
description: post.data.description,
link: `/blog/${post.slug}/`,
content: parser.render(post.body),
})),
customData: `<language>en-gb</language>`,
});
};