import { notFound } from "next/navigation"; import { allProjects } from "contentlayer/generated"; import { Mdx } from "@/app/components/mdx"; import { Header } from "./header"; import "./mdx.css"; import { ReportView } from "./view"; import { Redis } from "@upstash/redis"; export const revalidate = 60; type Props = { params: { slug: string; }; }; const redis = Redis.fromEnv(); export async function generateStaticParams(): Promise { return allProjects .filter((p) => p.published) .map((p) => ({ slug: p.slug, })); } export default async function PostPage({ params }: Props) { const slug = params?.slug; const project = allProjects.find((project) => project.slug === slug); if (!project) { notFound(); } const views = (await redis.get(["pageviews", "projects", slug].join(":"))) ?? 0; return (
); }