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 (
diff --git a/app/layout.tsx b/app/layout.tsx index 5f1d129..9668d87 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -21,6 +21,17 @@ const Layout = ({ children }: any) => ( title: 'artifacts', target: '', }, + 'divider', + { + link: 'https://git.chora.io', + title: 'git', + target: '_blank', + }, + { + link: '/artifacts/feed', + title: 'rss', + target: '_blank', + } ]} showMenuButton={true} showMobileTitle={true} diff --git a/app/page.tsx b/app/page.tsx index b81d8ef..5fad270 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -15,7 +15,7 @@ const HomePage = () => { {'chora'}

- {'a third thing or perhaps no thing'} + {'a third thing... or perhaps nothing'}

{'open protocol'}

diff --git a/bun.lockb b/bun.lockb index 8013ac2..dec4189 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index c551389..7c284b9 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "clean": "rm -rf .next dist node_modules" }, "dependencies": { + "feed": "^6", "gray-matter": "^4", "next": "^14", "react": "^18",