1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-03 17:46:39 -04:00

server all the actions!

This commit is contained in:
2025-02-08 12:37:41 -05:00
parent fa5edc003f
commit 37375b766f
27 changed files with 689 additions and 707 deletions

View File

@ -6,7 +6,7 @@ import config from "../../lib/config";
import { metadata as defaultMetadata } from "../layout";
import type { ReactElement } from "react";
import type { Metadata, Route } from "next";
import type { PostsByYear } from "../../types";
import type { FrontMatter } from "../../lib/helpers/posts";
import styles from "./page.module.css";
@ -27,7 +27,9 @@ export const metadata: Metadata = {
export default async function Page() {
// parse the year of each note and group them together
const notes = await getAllPosts();
const notesByYear: PostsByYear = {};
const notesByYear: {
[year: string]: FrontMatter[];
} = {};
notes.forEach((note) => {
const year = new Date(note.date).getUTCFullYear();
@ -45,7 +47,11 @@ export default async function Page() {
<li className={styles.post} key={slug}>
<Time date={date} format="MMM D" className={styles.postDate} />
<span>
<Link href={`/notes/${slug}` as Route} dangerouslySetInnerHTML={{ __html: htmlTitle || title }} />
<Link
href={`/notes/${slug}` as Route}
prefetch={null}
dangerouslySetInnerHTML={{ __html: htmlTitle || title }}
/>
</span>
</li>
))}