replace local content dir with env var

This commit is contained in:
amirhouieh 2022-05-20 11:21:43 +02:00
parent a2d60aae27
commit 460695ca2a
2 changed files with 2 additions and 20 deletions

View File

@ -33,12 +33,6 @@ export interface ISiteConfigs{
assets: {
logo: string
}
content: {
type: string;
source: string;
dist: string;
staticDir: string;
}
navigation: {
home: string;
}

View File

@ -1,11 +1,9 @@
import type {GetStaticPathsResult, GetStaticPropsContext, GetStaticPropsResult, PreviewData} from "next/types";
import {INavigationItemProps, IRouteParamForLocalFolder} from "../../types/data.types";
import {INavigationItemProps, IRouteParamForLocalFolder, ISiteConfigs} from "../../types/data.types";
import {readFileSync} from "fs";
import {join} from "path";
import matter from "gray-matter";
import logosConfigs from "../../logos.config";
const sidebar: INavigationItemProps[] = require("../../public/compiled/sidebar.flat.json");
const getStaticPathsFromFolder = () => async(): Promise<GetStaticPathsResult<IRouteParamForLocalFolder>> => {
@ -15,16 +13,6 @@ const getStaticPathsFromFolder = () => async(): Promise<GetStaticPathsResult<IRo
path: [],
}
})
// paths.push({
// params: {
// path: ["/"],
// }
// })
// paths.push({
// params: {
// path: [""],
// }
// })
return {
paths,
fallback: false
@ -41,7 +29,7 @@ export const getStaticPropsFromFolder = <O extends PreviewData>() => async(conte
}
}
const rawMD = readFileSync(join(logosConfigs.content.dist, navProps.localPath), 'utf-8');
const rawMD = readFileSync(join(process.cwd(), "docs", navProps.localPath), 'utf-8');
const {data: metadata, content} = matter(rawMD);
return {