From 8960aa88bd49bf70cb1f6d33e790696fc3a78af0 Mon Sep 17 00:00:00 2001 From: Pacharapol Withayasakpunt Date: Sun, 18 Apr 2021 09:50:25 +0700 Subject: [PATCH] fix comments --- packages/next/pages/post/[...path].tsx | 6 +++--- packages/next/scripts/make.ts | 4 ++-- packages/next/server/theme.ts | 5 +++-- theme.yml | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/next/pages/post/[...path].tsx b/packages/next/pages/post/[...path].tsx index 937a08d..943b88a 100644 --- a/packages/next/pages/post/[...path].tsx +++ b/packages/next/pages/post/[...path].tsx @@ -22,7 +22,7 @@ const PostPage = (post: IPost) => { window.remark42Instance = window.REMARK42.createInstance({ node: remark42Ref.current, host: THEME.comment.remark42.host, - site_id: THEME.comment.remark42.siteId + site_id: THEME.comment.remark42.site_id }) } @@ -97,7 +97,7 @@ export const getStaticPaths: GetStaticPaths = async () => { return { paths: dbPost.find().map(({ path }) => ({ - params: { path: path.split(/\//g).map(encodeURIComponent) } + params: { path: path.split(/\//g) } })), fallback: false } @@ -108,7 +108,7 @@ export const getStaticProps: GetStaticProps = async (ctx) => { return { props: dbPost.findOne({ - path: (ctx.params.path as string[]).map(decodeURIComponent).join('/') + path: (ctx.params.path as string[]).join('/') }) } } diff --git a/packages/next/scripts/make.ts b/packages/next/scripts/make.ts index acaec4e..13956eb 100644 --- a/packages/next/scripts/make.ts +++ b/packages/next/scripts/make.ts @@ -24,7 +24,7 @@ async function main () { await fs.writeFile( buildPath('theme.json'), JSON.stringify( - yaml.safeLoad(await fs.readFile(srcPath(THEME_FILENAME), 'utf8')) + yaml.load(await fs.readFile(srcPath(THEME_FILENAME), 'utf8')) ) ) @@ -40,7 +40,7 @@ async function main () { await Promise.all( files.map(async (f) => { const header = zMatter.parse( - yaml.safeLoad( + yaml.load( fs.readFileSync(srcPath('_post', f), 'utf-8').split(/\n---\n/)[0] ) ) diff --git a/packages/next/server/theme.ts b/packages/next/server/theme.ts index 3cbcddb..44011dc 100644 --- a/packages/next/server/theme.ts +++ b/packages/next/server/theme.ts @@ -47,8 +47,9 @@ export const zTheme = z remark42: z .object({ host: z.string(), - siteId: z.string() + site_id: z.string() }) + .nonstrict() .optional() }) .optional() @@ -59,6 +60,6 @@ export type ITheme = z.infer export function getTheme () { return zTheme.parse( - yaml.safeLoad(fs.readFileSync(buildPath(THEME_FILENAME), 'utf-8')) + yaml.load(fs.readFileSync(buildPath(THEME_FILENAME), 'utf-8')) ) } diff --git a/theme.yml b/theme.yml index 5493495..8630c91 100644 --- a/theme.yml +++ b/theme.yml @@ -23,4 +23,4 @@ analytics: comment: remark42: host: https://remark42.polv.cc - siteId: zhdiary + site_id: zhdiary