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,8 +1,8 @@
import path from 'path' import path from 'path'
import {Node} from "./node"
import {Transformer} from "./transformer";
const dirTree = require("directory-tree"); const dirTree = require("directory-tree");
import { Node } from "./node"
import { Transformer } from "./transformer";
function pathSelector(filename, allFilePaths){ function pathSelector(filename, allFilePaths){
if (filename.replace(".md", "") === "index"){ if (filename.replace(".md", "") === "index"){
@ -11,8 +11,7 @@ function pathSelector(filename, allFilePaths){
else if (filename.replace(".md", "") === "sidebar"){ else if (filename.replace(".md", "") === "sidebar"){
return "/sidebar.md" return "/sidebar.md"
} }
const editedFilePaths = allFilePaths.filter(f => !(f.endsWith("index.md") && f.endsWith("sidebar.md") )) return allFilePaths.filter(f => !(f.endsWith("index.md") && f.endsWith("sidebar.md")))
return editedFilePaths
} }

View File

@ -1,5 +1,5 @@
import Layout, {siteTitle} from "../components/layout"; 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"; import FolderTree from "../components/FolderTree";
export default function Home({content, graphdata, filenames, tree,flattenNodes, ...props}) { 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 { useRouter } from 'next/router'
import { useEffect,useRef } from "react"; import { useEffect,useRef } from "react";
import Layout, { siteTitle } from "../../components/layout"; 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"; import { Network } from "../../components/graph";