diff --git a/app/artifacts/choreography/feed/route.ts b/app/artifacts/choreography/feed/route.ts new file mode 100644 index 0000000..841bde3 --- /dev/null +++ b/app/artifacts/choreography/feed/route.ts @@ -0,0 +1,41 @@ +import { Feed } from "feed"; +import { getArtifacts } from "utils"; + +const SITE_URL = "https://chora.io/artifacts/choreography"; + +function getAllArtifacts() { + return [ + ...getArtifacts('choreography'), + ] +} + +export const revalidate = false; + +export async function GET() { + const feed = new Feed({ + title: "chora artifacts (choreography)", + description: "chora artifacts (choreography)", + id: SITE_URL, + link: SITE_URL, + language: "en", + feedLinks: { rss2: `${SITE_URL}/feed.xml` }, + ttl: 60, + }); + + for (const a of getAllArtifacts()) { + feed.addItem({ + title: a.title, + id: `${SITE_URL}/${a.id}`, + link: `${SITE_URL}/${a.id}`, + description: a.description, + date: a.created, + }); + } + + return new Response(feed.rss2(), { + headers: { + "Content-Type": "application/rss+xml; charset=utf-8", + "Cache-Control": "public, max-age=3600", + }, + }); +} diff --git a/app/artifacts/feed/route.ts b/app/artifacts/feed/route.ts new file mode 100644 index 0000000..0ed3cb7 --- /dev/null +++ b/app/artifacts/feed/route.ts @@ -0,0 +1,41 @@ +import { Feed } from "feed"; +import { getArtifacts } from "utils"; + +const SITE_URL = "https://chora.io/artifacts"; + +function getAllArtifacts() { + return [ + ...getArtifacts('choreography'), + ] +} + +export const revalidate = false; + +export async function GET() { + const feed = new Feed({ + title: "chora artifacts", + description: "chora artifacts", + id: SITE_URL, + link: SITE_URL, + language: "en", + feedLinks: { rss2: `${SITE_URL}/feed.xml` }, + ttl: 60, + }); + + for (const a of getAllArtifacts()) { + feed.addItem({ + title: a.title, + id: `${SITE_URL}/${a.category}/${a.id}`, + link: `${SITE_URL}/${a.category}/${a.id}`, + description: a.description, + date: a.created, + }); + } + + return new Response(feed.rss2(), { + headers: { + "Content-Type": "application/rss+xml; charset=utf-8", + "Cache-Control": "public, max-age=3600", + }, + }); +} diff --git a/app/artifacts/page.tsx b/app/artifacts/page.tsx index 801eec1..eb9b0aa 100644 --- a/app/artifacts/page.tsx +++ b/app/artifacts/page.tsx @@ -9,14 +9,14 @@ export const metadata: Metadata = { title: 'chora | artifacts', } -async function getResearchArtifacts() { +async function getAllArtifacts() { return [ { group: 'choreography', items: getArtifacts('choreography') }, ] } const ResearchPage = async () => { - const artifacts = await getResearchArtifacts() + const artifacts = await getAllArtifacts() return (
- {'a third thing or perhaps no thing'} + {'a third thing... or perhaps nothing'}
{'open protocol'}