mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-11-14 16:40:50 -05:00
refactor note processing functions
This commit is contained in:
@@ -3,7 +3,7 @@ import { notFound } from "next/navigation";
|
||||
import { join } from "path";
|
||||
import { existsSync } from "fs";
|
||||
import { readFile } from "fs/promises";
|
||||
import { getPostSlugs, getFrontMatter } from "../../../lib/helpers/posts";
|
||||
import { getSlugs, getFrontMatter } from "../../../lib/helpers/posts";
|
||||
import { POSTS_DIR, AVATAR_PATH } from "../../../lib/config/constants";
|
||||
|
||||
export const contentType = "image/png";
|
||||
@@ -18,7 +18,7 @@ export const dynamic = "force-static";
|
||||
export const dynamicParams = false;
|
||||
|
||||
export const generateStaticParams = async () => {
|
||||
const slugs = await getPostSlugs();
|
||||
const slugs = await getSlugs();
|
||||
|
||||
// map slugs into a static paths object required by next.js
|
||||
return slugs.map((slug) => ({
|
||||
|
||||
@@ -7,7 +7,7 @@ import Time from "../../../components/Time";
|
||||
import Comments from "../../../components/Comments";
|
||||
import Loading from "../../../components/Loading";
|
||||
import HitCounter from "./counter";
|
||||
import { getPostSlugs, getFrontMatter } from "../../../lib/helpers/posts";
|
||||
import { getSlugs, getFrontMatter } from "../../../lib/helpers/posts";
|
||||
import { addMetadata } from "../../../lib/helpers/metadata";
|
||||
import * as config from "../../../lib/config";
|
||||
import { BASE_URL } from "../../../lib/config/constants";
|
||||
@@ -24,7 +24,7 @@ export const dynamicParams = false;
|
||||
export const experimental_ppr = true;
|
||||
|
||||
export const generateStaticParams = async () => {
|
||||
const slugs = await getPostSlugs();
|
||||
const slugs = await getSlugs();
|
||||
|
||||
// map slugs into a static paths object required by next.js
|
||||
return slugs.map((slug) => ({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Link from "../../components/Link";
|
||||
import Time from "../../components/Time";
|
||||
import { getAllPosts } from "../../lib/helpers/posts";
|
||||
import { getFrontMatter } from "../../lib/helpers/posts";
|
||||
import { addMetadata } from "../../lib/helpers/metadata";
|
||||
import * as config from "../../lib/config";
|
||||
import type { ReactElement } from "react";
|
||||
@@ -19,7 +19,7 @@ export const metadata = addMetadata({
|
||||
|
||||
const Page = async () => {
|
||||
// parse the year of each note and group them together
|
||||
const notes = await getAllPosts();
|
||||
const notes = await getFrontMatter();
|
||||
const notesByYear: {
|
||||
[year: string]: FrontMatter[];
|
||||
} = {};
|
||||
|
||||
Reference in New Issue
Block a user