diff --git a/lib/post.js b/lib/utils.js similarity index 97% rename from lib/post.js rename to lib/utils.js index b3b9c89..bb00d77 100644 --- a/lib/post.js +++ b/lib/utils.js @@ -1,8 +1,8 @@ import path from 'path' +import {Node} from "./node" +import {Transformer} from "./transformer"; const dirTree = require("directory-tree"); -import { Node } from "./node" -import { Transformer } from "./transformer"; function pathSelector(filename, allFilePaths){ if (filename.replace(".md", "") === "index"){ @@ -11,8 +11,7 @@ function pathSelector(filename, allFilePaths){ else if (filename.replace(".md", "") === "sidebar"){ return "/sidebar.md" } - const editedFilePaths = allFilePaths.filter(f => !(f.endsWith("index.md") && f.endsWith("sidebar.md") )) - return editedFilePaths + return allFilePaths.filter(f => !(f.endsWith("index.md") && f.endsWith("sidebar.md"))) } diff --git a/pages/index.js b/pages/index.js index 503e747..3ce2fc1 100644 --- a/pages/index.js +++ b/pages/index.js @@ -1,5 +1,5 @@ import Layout, {siteTitle} from "../components/layout"; -import {getSinglePost, getGraphData, getDirectoryData, convertObject, getFlattenArray} from "../lib/post"; +import {getSinglePost, getGraphData, getDirectoryData, convertObject, getFlattenArray} from "../lib/utils"; import FolderTree from "../components/FolderTree"; export default function Home({content, graphdata, filenames, tree,flattenNodes, ...props}) { diff --git a/pages/note/[id].js b/pages/note/[id].js index b066659..4d5a6db 100644 --- a/pages/note/[id].js +++ b/pages/note/[id].js @@ -3,7 +3,7 @@ import Link from 'next/link' import { useRouter } from 'next/router' import { useEffect,useRef } from "react"; import Layout, { siteTitle } from "../../components/layout"; -import { getPostListData, getSinglePost, getGraphData} from "../../lib/post"; +import { getPostListData, getSinglePost, getGraphData} from "../../lib/utils"; import { Network } from "../../components/graph";