feat: update content

This commit is contained in:
ryanchristo 2026-11-20 09:24:21 -08:00
parent eaf8ed7d5d
commit ad1e22c631
No known key found for this signature in database
7 changed files with 122 additions and 54 deletions

12
app/feed/atom/route.ts Normal file
View file

@ -0,0 +1,12 @@
import { buildFeed } from "utils/buildFeed";
export const revalidate = false;
export async function GET() {
return new Response(buildFeed().atom1(), {
headers: {
"Content-Type": "application/atom+xml; charset=utf-8",
"Cache-Control": "public, max-age=3600",
},
});
}

12
app/feed/json/route.ts Normal file
View file

@ -0,0 +1,12 @@
import { buildFeed } from "utils/buildFeed";
export const revalidate = false;
export async function GET() {
return new Response(buildFeed().json1(), {
headers: {
"Content-Type": "application/feed+json; charset=utf-8",
"Cache-Control": "public, max-age=3600",
},
});
}

12
app/feed/rss/route.ts Normal file
View file

@ -0,0 +1,12 @@
import { buildFeed } from "utils/buildFeed";
export const revalidate = false;
export async function GET() {
return new Response(buildFeed().rss2(), {
headers: {
"Content-Type": "application/rss+xml; charset=utf-8",
"Cache-Control": "public, max-age=3600",
},
});
}

View file

@ -7,6 +7,11 @@ import './globals.css'
const Layout = ({ children }: any) => ( const Layout = ({ children }: any) => (
<html lang="en"> <html lang="en">
<head>
<link rel="alternate" type="application/rss+xml" title="rss" href="/feed/rss" />
<link rel="alternate" type="application/atom+xml" title="atom" href="/feed/atom" />
<link rel="alternate" type="application/feed+json" title="json" href="/feed/json" />
</head>
<body> <body>
<ThemeContextProvider> <ThemeContextProvider>
<MenuContextProvider> <MenuContextProvider>
@ -34,12 +39,7 @@ const Layout = ({ children }: any) => (
}, },
'divider', 'divider',
{ {
link: 'https://git.chora.studio/explore/repos', link: '/feed/rss',
title: 'git',
target: '_blank',
},
{
link: '/research/feed',
title: 'rss', title: 'rss',
target: '_blank', target: '_blank',
}, },
@ -69,14 +69,19 @@ const Layout = ({ children }: any) => (
target: '', target: '',
title: 'services', title: 'services',
}, },
{
link: '/feed/rss',
title: 'rss',
target: '_blank',
},
{ {
link: 'https://git.chora.studio/explore/repos', link: 'https://git.chora.studio/explore/repos',
title: 'git', title: 'git',
target: '_blank', target: '_blank',
}, },
{ {
link: '/research/feed', link: '/key.asc',
title: 'rss', title: 'pgp',
target: '_blank', target: '_blank',
}, },
]} ]}
@ -118,16 +123,22 @@ const Layout = ({ children }: any) => (
{ {
title: 'more links', title: 'more links',
items: [ items: [
{
link: '/feed/rss',
title: 'rss',
target: '_blank',
},
{ {
link: 'https://git.chora.studio/explore/repos', link: 'https://git.chora.studio/explore/repos',
title: 'git', title: 'git',
target: '_blank', target: '_blank',
}, },
{ {
link: '/research/feed', link: '/key.asc',
title: 'rss', title: 'pgp',
target: '_blank', target: '_blank',
},], },
],
}, },
]} ]}
/> />

View file

@ -1,43 +0,0 @@
import { Feed } from "feed";
import { getArtifacts } from "utils";
const SITE_URL = "https://chora.studio/research";
function getAllArtifacts() {
return [
...getArtifacts('about'),
...getArtifacts('concepts'),
...getArtifacts('tutorials'),
]
}
export const revalidate = false;
export async function GET() {
const feed = new Feed({
title: "chora research",
description: "chora research",
id: SITE_URL,
link: SITE_URL,
language: "en",
feedLinks: { rss2: `${SITE_URL}/feed` },
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",
},
});
}

13
public/key.asc Normal file
View file

@ -0,0 +1,13 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
mDMEav+VlBYJKwYBBAHaRw8BAQdA70d670oZGo4AvlCqbxqgM+0u4TPJa3XkfBqV
QkDuFEW0I2Nob3JhIHN0dWRpbyA8Y29udGFjdEBjaG9yYS5zdHVkaW8+iJAEExYK
ADgWIQRWiSpiiJynA0ZwpKdgblby/xqZeAUCav+VlAIbAwULCQgHAgYVCgkICwIE
FgIDAQIeAQIXgAAKCRBgblby/xqZeF0CAQC/UbB5EVdmj28tvQ4uJ+k0G0+iAFPJ
AFtecs9w+yRjDAEA9OkUyZOhKGbiBlX6sBBNH6e6zo+oM4kNAKCftblVxwW4OARq
/5WUEgorBgEEAZdVAQUBAQdA+t+sKdDzPUAwaKVlwQw12YScO2XVQSHrkkXvO3m2
UFMDAQgHiHgEGBYKACAWIQRWiSpiiJynA0ZwpKdgblby/xqZeAUCav+VlAIbDAAK
CRBgblby/xqZeA7EAP9BfLf95kq8V1a8AclicIwHc4+boTeFSjU9UhgoNXXSqgD9
FXv374OXscR4azTXMni31bwMcpfpokUqQ093ix79DAk=
=a/sf
-----END PGP PUBLIC KEY BLOCK-----

51
utils/buildFeed.ts Normal file
View file

@ -0,0 +1,51 @@
import { Feed } from "feed";
import { getArtifacts } from "utils";
// const SITE_URL = "http://localhost:3000";
const SITE_URL = "https://chora.studio";
function getAllArtifacts() {
return [
// ...getArtifacts('about'),
...getArtifacts('concepts'),
// ...getArtifacts('tutorials'),
]
}
export function buildFeed() {
const feed = new Feed({
title: "Chora Studio's Feed",
description: "Chora Studio's Feed",
id: SITE_URL,
link: SITE_URL,
language: "en",
favicon: `${SITE_URL}/favicon.ico`,
feedLinks: {
atom: `${SITE_URL}/feed/atom`,
json: `${SITE_URL}/feed/json`,
rss2: `${SITE_URL}/feed/rss`,
},
author: { name: "Chora Studio" },
copyright: "Creative Commons",
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.updated,
published: a.created,
author: [{ name: a.author }],
category: [{ name: a.category }],
// content: a.content,
// audio: a.audio,
// video: a.video,
copyright: "Creative Commons",
});
}
return feed;
}