Files
website-astro-stefanimhoff.de/src/pages/rss-sketchnotes.xml.js
2023-06-13 15:24:49 +02:00

24 lines
722 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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>`,
});
}