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',
|
title: 'chora | artifacts',
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getResearchArtifacts() {
|
async function getAllArtifacts() {
|
||||||
return [
|
return [
|
||||||
{ group: 'choreography', items: getArtifacts('choreography') },
|
{ group: 'choreography', items: getArtifacts('choreography') },
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
const ResearchPage = async () => {
|
const ResearchPage = async () => {
|
||||||
const artifacts = await getResearchArtifacts()
|
const artifacts = await getAllArtifacts()
|
||||||
return (
|
return (
|
||||||
<div className={styles.page}>
|
<div className={styles.page}>
|
||||||
<div className={styles.banner}>
|
<div className={styles.banner}>
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,17 @@ const Layout = ({ children }: any) => (
|
||||||
title: 'artifacts',
|
title: 'artifacts',
|
||||||
target: '',
|
target: '',
|
||||||
},
|
},
|
||||||
|
'divider',
|
||||||
|
{
|
||||||
|
link: 'https://git.chora.io',
|
||||||
|
title: 'git',
|
||||||
|
target: '_blank',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
link: '/artifacts/feed',
|
||||||
|
title: 'rss',
|
||||||
|
target: '_blank',
|
||||||
|
}
|
||||||
]}
|
]}
|
||||||
showMenuButton={true}
|
showMenuButton={true}
|
||||||
showMobileTitle={true}
|
showMobileTitle={true}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ const HomePage = () => {
|
||||||
{'chora'}
|
{'chora'}
|
||||||
</h1>
|
</h1>
|
||||||
<p>
|
<p>
|
||||||
<i>{'a third thing or perhaps no thing'}</i>
|
<i>{'a third thing... or perhaps nothing'}</i>
|
||||||
</p>
|
</p>
|
||||||
<p>{'open protocol'}</p>
|
<p>{'open protocol'}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
BIN
bun.lockb
BIN
bun.lockb
Binary file not shown.
|
|
@ -20,6 +20,7 @@
|
||||||
"clean": "rm -rf .next dist node_modules"
|
"clean": "rm -rf .next dist node_modules"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"feed": "^6",
|
||||||
"gray-matter": "^4",
|
"gray-matter": "^4",
|
||||||
"next": "^14",
|
"next": "^14",
|
||||||
"react": "^18",
|
"react": "^18",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue