import { InView } from "react-intersection-observer"; import { NextSeo, ArticleJsonLd } from "next-seo"; import { MDXRemote, MDXRemoteProps } from "next-mdx-remote"; import Content from "../../components/Content"; import NoteMeta from "../../components/NoteMeta"; import Comments from "../../components/Comments"; import * as mdxComponents from "../../lib/helpers/mdx-components"; import { getNoteSlugs } from "../../lib/helpers/parse-notes"; import { compileNote } from "../../lib/helpers/compile-note"; import * as config from "../../lib/config"; import { articleJsonLd, favicons } from "../../lib/config/seo"; import type { GetStaticProps, GetStaticPaths, InferGetStaticPropsType } from "next"; import type { NoteWithSource, NoteFrontMatter } from "../../types"; const Note = ({ frontMatter, source }: InferGetStaticPropsType) => { return ( <> {!frontMatter.noComments && ( {({ inView, ref }) =>
{inView && }
}
)} ); }; export const getStaticProps: GetStaticProps> = async ({ params }) => { if (!params?.slug) { return { notFound: true, }; } const { frontMatter, source } = await compileNote(params.slug); return { props: { frontMatter, source, }, }; }; export const getStaticPaths: GetStaticPaths = async () => { const slugs = await getNoteSlugs(); const paths = slugs.map((slug) => ({ params: { slug } })); return { paths, fallback: false, }; }; export default Note;