fix comments

This commit is contained in:
polv committed 2021-04-18 09:50:25 +07:00
1 parent a311ef72d3
commit 8960aa88bd
4 files changed
+9 -8

No files matched your search

+3 -3
View File
@@ -22,7 +22,7 @@ const PostPage = (post: IPost) => {
window.remark42Instance = window.REMARK42.createInstance({ window.remark42Instance = window.REMARK42.createInstance({
node: remark42Ref.current, node: remark42Ref.current,
host: THEME.comment.remark42.host, 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 { return {
paths: dbPost.find().map(({ path }) => ({ paths: dbPost.find().map(({ path }) => ({
params: { path: path.split(/\//g).map(encodeURIComponent) } params: { path: path.split(/\//g) }
})), })),
fallback: false fallback: false
} }
@@ -108,7 +108,7 @@ export const getStaticProps: GetStaticProps = async (ctx) => {
return { return {
props: dbPost.findOne({ props: dbPost.findOne({
path: (ctx.params.path as string[]).map(decodeURIComponent).join('/') path: (ctx.params.path as string[]).join('/')
}) })
} }
} }
+2 -2
View File
@@ -24,7 +24,7 @@ async function main () {
await fs.writeFile( await fs.writeFile(
buildPath('theme.json'), buildPath('theme.json'),
JSON.stringify( 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( await Promise.all(
files.map(async (f) => { files.map(async (f) => {
const header = zMatter.parse( const header = zMatter.parse(
yaml.safeLoad( yaml.load(
fs.readFileSync(srcPath('_post', f), 'utf-8').split(/\n---\n/)[0] fs.readFileSync(srcPath('_post', f), 'utf-8').split(/\n---\n/)[0]
) )
) )
+3 -2
View File
@@ -47,8 +47,9 @@ export const zTheme = z
remark42: z remark42: z
.object({ .object({
host: z.string(), host: z.string(),
siteId: z.string() site_id: z.string()
}) })
.nonstrict()
.optional() .optional()
}) })
.optional() .optional()
@@ -59,6 +60,6 @@ export type ITheme = z.infer<typeof zTheme>
export function getTheme () { export function getTheme () {
return zTheme.parse( return zTheme.parse(
yaml.safeLoad(fs.readFileSync(buildPath(THEME_FILENAME), 'utf-8')) yaml.load(fs.readFileSync(buildPath(THEME_FILENAME), 'utf-8'))
) )
} }
+1 -1
View File
@@ -23,4 +23,4 @@ analytics:
comment: comment:
remark42: remark42:
host: https://remark42.polv.cc host: https://remark42.polv.cc
siteId: zhdiary site_id: zhdiary