import { InView } from "react-intersection-observer";
import { NextSeo, ArticleJsonLd } from "next-seo";
import { MDXRemote } 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 } from "../../lib/config/seo";
import type { GetStaticProps, GetStaticPaths } from "next";
import type { Note, NoteFrontMatter } from "../../types";
const Note = ({ frontMatter, source }: Note) => {
return (
<>
{/* comments can be disabled for an individual post via `noComments: true` in its front matter */}
{!frontMatter.noComments && (
{({ inView, ref }) => (
)}
)}
>
);
};
export const getStaticProps: GetStaticProps = async ({ params }: { params: Pick }) => {
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;