36dcfbb2bc
Boiler plate code for adding multiple MD Content
33 lines
944 B
JavaScript
33 lines
944 B
JavaScript
import Layout from "../components/layout";
|
|
import {getSinglePost, getDirectoryData, convertObject, getFlattenArray} from "../lib/utils";
|
|
import FolderTree from "../components/FolderTree";
|
|
import MDContainer from "../components/MDContainer";
|
|
|
|
export default function Home({content, tree, flattenNodes}) {
|
|
|
|
return (
|
|
<Layout>
|
|
<div className = 'container'>
|
|
<nav className="nav-bar">
|
|
<FolderTree tree={tree} flattenNodes={flattenNodes}/>
|
|
</nav>
|
|
<MDContainer post={content.data}/>
|
|
</div>
|
|
</Layout>
|
|
);
|
|
|
|
}
|
|
|
|
export function getStaticProps() {
|
|
const tree = convertObject(getDirectoryData());
|
|
const contentData = getSinglePost("index");
|
|
const flattenNodes = getFlattenArray(tree)
|
|
return {
|
|
props: {
|
|
content: contentData,
|
|
tree: tree,
|
|
flattenNodes: flattenNodes
|
|
},
|
|
};
|
|
}
|