diff options
| author | Joe Carstairs <65492573+Sycamost@users.noreply.github.com> | 2023-08-25 18:22:00 +0100 |
|---|---|---|
| committer | Joe Carstairs <65492573+Sycamost@users.noreply.github.com> | 2023-08-25 18:24:09 +0100 |
| commit | a1c465e86bca672df8af4c3fba88ebf5f1a3ec56 (patch) | |
| tree | 350b6de1c646b5757922114a14197a5c71ada539 /src/pages | |
| parent | 6972d357c69495b6e1beee75e8441815bd3d5c72 (diff) | |
Adds Scotsoun to RSS feed
Diffstat (limited to 'src/pages')
| -rw-r--r-- | src/pages/[locale]/rss.xml.ts | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/pages/[locale]/rss.xml.ts b/src/pages/[locale]/rss.xml.ts index 0feb866..61eeeae 100644 --- a/src/pages/[locale]/rss.xml.ts +++ b/src/pages/[locale]/rss.xml.ts @@ -9,6 +9,8 @@ import tFeed from '$i18n/translations/pages/rss.xml'; import type LallansIssue from '$types/LallansIssue'; import type Locale from '$types/Locale'; import { getAllLallansIssues } from '$data/lallans'; +import type Scotsoun from '$types/Scotsoun'; +import { getAllScotsoun } from '$data/scotsoun'; export async function get(context: APIContext) { const locale = getLocaleFromPath(context.url.pathname); @@ -20,12 +22,17 @@ export async function get(context: APIContext) { const news = (await getCollection('news')).filter((item) => isNewsItemInLocale(item, locale)); const lallans = await getAllLallansIssues(); + const scotsoun = await getAllScotsoun(); return rss({ title: t(tFeed, { key: 'title' }), description: t(tFeed, { key: 'description' }), site, - items: [...news.map(newsItemToRssFeedItem), ...lallans.map(lallansIssueToRssFeedItem(locale))], + items: [ + ...news.map(newsItemToRssFeedItem), + ...lallans.map(lallansIssueToRssFeedItem(locale)), + ...scotsoun.map(scotsounReleaseToRssFeedItem(locale)), + ], customData: `<language>${locale}</language>`, }); } @@ -55,6 +62,17 @@ function lallansIssueToRssFeedItem(locale: Locale) { }; } +function scotsounReleaseToRssFeedItem(locale: Locale) { + return function (release: Scotsoun): RSSFeedItem { + return { + link: `/${locale}/furthsettins/scotsoun/${release.scotsounId}`, + title: release.title, + description: release.description?.[locale] ?? release.longName, + pubDate: new Date(release.uploadDate), + }; + }; +} + export async function getStaticPaths() { return localeStaticPaths; } |
