Draft links page
This commit is contained in:
parent
db0ec6f797
commit
7f8132d33e
4 changed files with 322 additions and 0 deletions
42
content/links.tsx
Normal file
42
content/links.tsx
Normal file
|
@ -0,0 +1,42 @@
|
|||
import { readFileSync } from "node:fs";
|
||||
import { BasePage } from "./bases.js";
|
||||
import type { Page } from "./types.js";
|
||||
|
||||
interface LinkData {
|
||||
title: string,
|
||||
url: string,
|
||||
tags: string[],
|
||||
description?: string,
|
||||
read?: string,
|
||||
author?: string,
|
||||
}
|
||||
interface Data {
|
||||
links: LinkData[];
|
||||
to_read: string[],
|
||||
authors: Record<string, {
|
||||
urls: string[],
|
||||
}>;
|
||||
}
|
||||
function Link(props: { link: LinkData }) {
|
||||
const link = props.link;
|
||||
return <>
|
||||
<a href={link.url}>{link.title}</a>
|
||||
{" "}
|
||||
{link.tags.join(", ")}
|
||||
</>
|
||||
}
|
||||
const data: Data = eval(`(${readFileSync("content/links.jsonc", "utf8")})`);
|
||||
data.links.pop(); // Remove template at the end
|
||||
const title = "Links!";
|
||||
export const links: Page = {
|
||||
title,
|
||||
ref: "/links.html",
|
||||
content: <BasePage title={title}>
|
||||
<main>
|
||||
<h1>{title}</h1>
|
||||
<ul>
|
||||
{ data.links.map(link => <li><Link link={link} /></li>)}
|
||||
</ul>
|
||||
</main>
|
||||
</BasePage>
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue