import Layout from 'components/Layout' import Util from 'lib/utils' import FolderTree from 'components/FolderTree' import MDContent, { type LinkType } from 'components/MDContent' export interface HomeProps { content: string tree: Record flattenNodes: unknown[] backLinks: LinkType[] } export default function Home({ content, tree, flattenNodes, backLinks }: HomeProps) { return (
) } export function getStaticProps() { const { nodes, edges }: { nodes: unknown[], edges: unknown[] } = Util.constructGraphData() const tree = Util.convertObject(Util.getDirectoryData()) const contentData = Util.getSinglePost('index') const flattenNodes = Util.getFlattenArray(tree) // const listOfEdges = edges // .filter((anEdge) => ( // anEdge as { target: string }).target === 'index' // ) // const internalLinks = listOfEdges.map( // anEdge => nodes // .find( // aNode => ( // aNode as { slug: string }).slug === (anEdge as { source: string }).source)) // .filter( // element => element !== undefined) //const backLinks = [...new Set(internalLinks)] return { props: { content: contentData.data, tree, flattenNodes, // backLinks, body_class_name: 'm-0 p-0' } } }