import { fetchMarkdownPosts, type Post } from '$lib/utils'; const siteURL = 'https://silentsilas.com'; const siteTitle = 'silentsilas - Poetry'; const siteDescription = 'Read some bad poetry.'; export const prerender = true; export const GET = async () => { const { posts } = await fetchMarkdownPosts('poetry'); const body = render(posts); const options = { headers: { 'Cache-Control': 'max-age=0, s-maxage=604800', 'Content-Type': 'application/atom+xml' } }; return new Response(body, options); }; const render = (posts: Post[]) => ` ${siteTitle} ${siteDescription} ${siteURL}/poetry ${posts .map( (post) => ` ${siteURL}/${post.section}/${post.filename} ${post.meta.title} ${siteURL}/${post.section}/${post.filename} ${post.meta.title} ${new Date(post.meta.date).toUTCString()} ` ) .join('')} `;