update content
This commit is contained in:
parent
836f960a28
commit
d22eb07a55
12 changed files with 217 additions and 1 deletions
24
app/artifacts/videos/[id]/page.module.css
Normal file
24
app/artifacts/videos/[id]/page.module.css
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
.container {
|
||||
composes: container from "../../../../styles/page.css";
|
||||
}
|
||||
|
||||
.banner {
|
||||
composes: banner from "../../../../styles/page.css";
|
||||
}
|
||||
|
||||
.content {
|
||||
composes: content from "../../../../styles/page.css";
|
||||
}
|
||||
|
||||
.content {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.content h1 {
|
||||
font-size: 1.6em;
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
.content p {
|
||||
margin: 1em 0;
|
||||
}
|
||||
37
app/artifacts/videos/[id]/page.tsx
Normal file
37
app/artifacts/videos/[id]/page.tsx
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
import { Metadata } from "next";
|
||||
|
||||
import { getArtifact, getArtifacts } from "@utils";
|
||||
|
||||
import styles from "./page.module.css";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "ryan christoffersen | artifacts",
|
||||
};
|
||||
|
||||
export const generateStaticParams = () => {
|
||||
return getArtifacts("videos");
|
||||
};
|
||||
|
||||
const ArtifactPage = async ({ params }: any) => {
|
||||
const artifact = await getArtifact("videos", params.id);
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<div>
|
||||
<div className={styles.banner}>
|
||||
<div>
|
||||
<p>{`author: ${artifact.author}`}</p>
|
||||
<p>{`title: ${artifact.title}`}</p>
|
||||
<p>{`description: ${artifact.description}`}</p>
|
||||
<p>{`created: ${artifact.created.toDateString()}`}</p>
|
||||
<p>{`updated: ${artifact.updated.toDateString()}`}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className={styles.content}>
|
||||
<div dangerouslySetInnerHTML={{ __html: artifact.content }} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default ArtifactPage;
|
||||
41
app/artifacts/videos/feed/route.ts
Normal file
41
app/artifacts/videos/feed/route.ts
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
import { Feed } from "feed";
|
||||
import { getArtifacts } from "utils";
|
||||
|
||||
const SITE_URL = "https://chora.io/artifacts/videos";
|
||||
|
||||
function getAllArtifacts() {
|
||||
return [
|
||||
...getArtifacts('videos'),
|
||||
]
|
||||
}
|
||||
|
||||
export const revalidate = false;
|
||||
|
||||
export async function GET() {
|
||||
const feed = new Feed({
|
||||
title: "ryan's artifacts (videos)",
|
||||
description: "ryan's artifacts (videos)",
|
||||
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.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",
|
||||
},
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue