Rename post to utils

This commit is contained in:
Tuan Cao 2022-03-24 11:55:12 +07:00
parent 005993da21
commit bae2cc6be7
3 changed files with 5 additions and 6 deletions

View File

@ -1,9 +1,9 @@
import path from 'path'
const dirTree = require("directory-tree");
import {Node} from "./node"
import {Transformer} from "./transformer";
const dirTree = require("directory-tree");
function pathSelector(filename, allFilePaths){
if (filename.replace(".md", "") === "index"){
return "/index.md"
@ -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")))
}

View File

@ -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}) {

View File

@ -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";