diff --git a/src/pages/updates/[slug].astro b/src/pages/updates/[slug].astro new file mode 100644 index 0000000..6e99516 --- /dev/null +++ b/src/pages/updates/[slug].astro @@ -0,0 +1,243 @@ +--- +import { getCollection, getEntry } from 'astro:content'; +import AppLayout from '../../layouts/AppLayout.astro'; +import { fmtDate } from '../../lib/markdown'; + +const user = Astro.locals.user; +const { slug } = Astro.params; + +const update = await getEntry('updates', slug as string); +if (!update) return Astro.redirect('/updates'); + +const { Content } = await update.render(); + +const allUpdates = await getCollection('updates'); +const sorted = allUpdates.sort( + (a, b) => new Date(b.data.date).getTime() - new Date(a.data.date).getTime() +); +const currentIndex = sorted.findIndex((u) => u.slug === update.slug); +const prev = sorted[currentIndex + 1] ?? null; +const next = sorted[currentIndex - 1] ?? null; +--- + +
+ + + +
+
+ +

{update.data.title}

+

{update.data.summary}

+ +
+ +
+ +
+
+ + + +
+
+ + diff --git a/src/pages/updates/feed.xml.ts b/src/pages/updates/feed.xml.ts new file mode 100644 index 0000000..875bd97 --- /dev/null +++ b/src/pages/updates/feed.xml.ts @@ -0,0 +1,41 @@ +import type { APIRoute } from 'astro'; +import { getCollection } from 'astro:content'; + +export const GET: APIRoute = async ({ site }) => { + const updates = await getCollection('updates'); + const sorted = updates.sort( + (a, b) => new Date(b.data.date).getTime() - new Date(a.data.date).getTime() + ); + + const base = 'https://bifrost.fenja.ai'; + + const items = sorted.map((u) => { + const url = `${base}/updates/${u.slug}`; + const date = new Date(u.data.date).toUTCString(); + return ` + + <![CDATA[${u.data.title}]]> + + ${url} + ${url} + ${date} + ${u.data.author} + `; + }); + + const xml = ` + + + Project Bifrost — Updates + Progress notes from Fenja AI during the Bifrost pilot. + ${base}/updates + + en + ${items.join('')} + +`; + + return new Response(xml, { + headers: { 'Content-Type': 'application/rss+xml; charset=utf-8' }, + }); +}; diff --git a/src/pages/updates/index.astro b/src/pages/updates/index.astro new file mode 100644 index 0000000..f76f5f9 --- /dev/null +++ b/src/pages/updates/index.astro @@ -0,0 +1,171 @@ +--- +import { getCollection } from 'astro:content'; +import AppLayout from '../../layouts/AppLayout.astro'; +import { fmtDate } from '../../lib/markdown'; + +const user = Astro.locals.user; + +const allUpdates = await getCollection('updates'); +const updates = allUpdates.sort( + (a, b) => new Date(b.data.date).getTime() - new Date(a.data.date).getTime() +); +--- + +
+ + + +
    + {updates.map((update) => ( +
  1. + + +
  2. + ))} +
+ + + +
+
+ +