add feed
This commit is contained in:
parent
71590024e7
commit
c135cb24f1
7 changed files with 97 additions and 3 deletions
41
app/artifacts/choreography/feed/route.ts
Normal file
41
app/artifacts/choreography/feed/route.ts
Normal file
|
|
@ -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",
|
||||
},
|
||||
});
|
||||
}
|
||||
41
app/artifacts/feed/route.ts
Normal file
41
app/artifacts/feed/route.ts
Normal file
|
|
@ -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",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
@ -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 (
|
||||
<div className={styles.page}>
|
||||
<div className={styles.banner}>
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ const HomePage = () => {
|
|||
{'chora'}
|
||||
</h1>
|
||||
<p>
|
||||
<i>{'a third thing or perhaps no thing'}</i>
|
||||
<i>{'a third thing... or perhaps nothing'}</i>
|
||||
</p>
|
||||
<p>{'open protocol'}</p>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue