import Document, { Html, Head, Main, NextScript } from 'next/document' import { useRouter } from 'next/router' import { useMemo } from "react"; import { getSinglePost } from "../lib/post"; import Link from 'next/link'; class MyDocument extends Document { static async getInitialProps(ctx) { const initialProps = await Document.getInitialProps(ctx) //console.log("doc", initialProps) const sidebar = getSinglePost("sidebar") return { sidebar, ...initialProps } } render(props) { //console.log("document: ", this.props) return ( {/* NAVBAR */}
{/* SIDEBAR */}
) } } export function getStaticProps() { const sidebarData = getSinglePost("sidebar.md"); console.log("index response: ", contentData, sidebarData) return { props: { sidebar:sidebarData }, }; } export default MyDocument