feat: add RSS feeds for Haiku, AI Art, and Sketchnotes

This commit is contained in:
Stefan Imhoff
2023-06-13 15:24:49 +02:00
parent 6aa03bae05
commit aa4b69f29c
5 changed files with 89 additions and 0 deletions

View File

@@ -21,6 +21,7 @@
"@astrojs/mdx": "^0.19.4",
"@astrojs/preact": "^2.2.0",
"@astrojs/prefetch": "^0.2.3",
"@astrojs/rss": "^2.4.3",
"@astrojs/sitemap": "^1.3.3",
"@astrojs/tailwind": "^3.1.3",
"astro": "^2.5.5",

21
pnpm-lock.yaml generated
View File

@@ -21,6 +21,9 @@ dependencies:
'@astrojs/prefetch':
specifier: ^0.2.3
version: 0.2.3
'@astrojs/rss':
specifier: ^2.4.3
version: 2.4.3
'@astrojs/sitemap':
specifier: ^1.3.3
version: 1.3.3
@@ -326,6 +329,13 @@ packages:
prismjs: 1.29.0
dev: false
/@astrojs/rss@2.4.3:
resolution: {integrity: sha512-Dc8lxsXiDlnxONVIUuc3ohO1+vV1Hp9fRFdUianOola0S9/xv/6FzIHhkQ62MkaFSlcZm5uIOllRWNKVvuFuoA==}
dependencies:
fast-xml-parser: 4.2.4
kleur: 4.1.5
dev: false
/@astrojs/sitemap@1.3.3:
resolution: {integrity: sha512-TPyyb/hKxc+bHPpSoNPhsuI0QOTVzq2tueg2r0CTH1HqigYIAA2LQkCBlQzz85R+LrOZpv4kXYmhxdDcSkJCmA==}
dependencies:
@@ -7308,6 +7318,13 @@ packages:
resolution: {integrity: sha512-cIusKBIt/R/oI6z/1nyfe2FvGKVTohVRfvkOhvx0nCEW+xf5NoCXjAHcWp93uOUBchzYcsvPlrapAdX1uW+YGg==}
dev: true
/fast-xml-parser@4.2.4:
resolution: {integrity: sha512-fbfMDvgBNIdDJLdLOwacjFAPYt67tr31H9ZhWSm45CDAxvd0I6WTlSOUo7K2P/K5sA5JgMKG64PI3DMcaFdWpQ==}
hasBin: true
dependencies:
strnum: 1.0.5
dev: false
/fastest-levenshtein@1.0.16:
resolution: {integrity: sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==}
engines: {node: '>= 4.9.1'}
@@ -13913,6 +13930,10 @@ packages:
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
dev: true
/strnum@1.0.5:
resolution: {integrity: sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==}
dev: false
/strtok3@6.3.0:
resolution: {integrity: sha512-fZtbhtvI9I48xDSywd/somNqgUHl2L2cstmXCCif0itOf96jeW18MBSyrLuNicYQVkvpOxkZtkzujiTJ9LW5Jw==}
engines: {node: '>=10'}

View File

@@ -0,0 +1,23 @@
import rss from '@astrojs/rss';
import { getCollection } from 'astro:content';
import { site } from '../data/site';
export async function get(context) {
const aiArt = await getCollection('ai-art');
return rss({
title: `${site.title} (AI Art)`,
description: 'This is a collection of AI art pieces Ive created with Stable Diffusion.',
site: context.site,
items: aiArt.map((item) => ({
title: item.data.title,
pubDate: item.data.date,
customData: '<language>en-us</language>',
link: `/ai-art/${item.slug}/`,
content: `<div>${item.data.images
.map((img) => `<img alt="${item.data.title}" src="${img.src}" />`)
.join('')}</div>`,
})),
customData: `<language>en-us</language>`,
});
}

View File

@@ -0,0 +1,21 @@
import rss from '@astrojs/rss';
import { getCollection } from 'astro:content';
import { site } from '../data/site';
export async function get(context) {
const haiku = await getCollection('haiku');
return rss({
title: `${site.title} (Haiku)`,
description: 'This is an ever-growing collection of Haiku I have written.',
site: context.site,
items: haiku.map((item) => ({
title: `Haiku ${item.slug}`,
pubDate: item.data.date,
customData: '<language>en-us</language>',
link: `/haiku/${item.slug}/`,
content: `<div><p>${item.data.de}</p><hr /><p>${item.data.en}</p></div>`,
})),
customData: `<language>en-us</language>`,
});
}

View File

@@ -0,0 +1,23 @@
import rss from '@astrojs/rss';
import { getCollection } from 'astro:content';
import { site } from '../data/site';
export async function get(context) {
const sketchnotes = await getCollection('sketchnotes');
return rss({
title: `${site.title} (Sketchnotes)`,
description: 'This is a collection of Sketchnotes Ive drawn.',
site: context.site,
items: sketchnotes.map((item) => ({
title: item.data.title,
pubDate: item.data.date,
customData: '<language>en-us</language>',
link: `/sketchnotes/${item.slug}/`,
content: `<div>${item.data.images
.map((img) => `<img alt="${item.data.title}" src="${img.src}" />`)
.join('')}</div>`,
})),
customData: `<language>en-us</language>`,
});
}