diff --git a/src/routes/blog/rss.xml/+server.ts b/src/routes/blog/rss.xml/+server.ts index 52aa732..ac85b3f 100644 --- a/src/routes/blog/rss.xml/+server.ts +++ b/src/routes/blog/rss.xml/+server.ts @@ -1,4 +1,4 @@ -import { fetchPostsSorted, resolveBlogPath } from "$src/lib/util/Blogs"; +import { EventStatus, fetchPostsSorted, postEventStatus, resolveBlogPath } from "$lib/util/Blogs"; export const prerender = true; @@ -41,6 +41,14 @@ function makeAuthors(post: App.BlogPost): string { return `\n${authorsString}`; } +function makeEventDescription(post: App.BlogPost): string { + if (postEventStatus(post) === EventStatus.NotEvent) + return ''; + + const dateToUtcString = (s: string) => new Date(s).toUTCString(); + return `

Событие проводится с ${dateToUtcString(post.dateEventFrom!)} по ${dateToUtcString(post.dateEventFrom!)}.`; +} + export async function GET({ setHeaders }) { setHeaders({ 'Cache-Control': 'max-age=0, s-maxage=3600', @@ -57,7 +65,7 @@ export async function GET({ setHeaders }) { 1800 ${posts.map((post) => ` ${escapeXml(post.title)} -${makeAuthors(post)} +${makeAuthors(post)} https://teasanctuary.ru/blog/${post.slug} https://teasanctuary.ru/blog/${post.slug} ${(new Date(post.date!)).toUTCString()}