import type { GetServerSideProps, NextPage } from "next"; import Layout from "../../../components/Blog/Layout"; import DiaryPageSelector from "../../../components/Blog/DiaryPageSelector"; import { generateContent, getContentList } from "../../../lib/content/generateBackend"; import type { ContentList, Diary } from "../../../lib/content/types"; import styles from "../../../styles/Blog/Content.module.scss"; interface IContentRender extends Diary { html: string; } const DiaryMain: NextPage<{ content: IContentRender }> = ({ content }) => { return e.title)} />
e.title)} bottom />
; }; export const getServerSideProps: GetServerSideProps = async (context) => { const { did } = context.query; const contentList = await getContentList(); const contentEntry: Diary | undefined = (contentList as ContentList).find((c) => c.name === did && c.type === "diary") as Diary | undefined; if (!contentEntry) return { notFound: true }; const contentHtml = await generateContent(contentEntry); return { props: { content: { ...contentEntry, html: contentHtml } } }; }; export default DiaryMain;