From 129cbce901c5cc4c3c67fdb4047525a63563a5aa Mon Sep 17 00:00:00 2001 From: Xevion Date: Mon, 11 Mar 2024 00:06:33 -0500 Subject: [PATCH] Trim, console log lastModified --- src/pages/[...slug].astro | 4 ++++ src/plugins/remark-last-modified.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pages/[...slug].astro b/src/pages/[...slug].astro index bd981f2..462611c 100644 --- a/src/pages/[...slug].astro +++ b/src/pages/[...slug].astro @@ -15,6 +15,10 @@ const isProd = import.meta.env.PROD; const {render, data} = Astro.props; const {title, lastModified} = data; const { Content, headings } = await render(); + +if (isProd && lastModified === undefined) { + console.log({props: Astro.props, content: Content}) +} ---
diff --git a/src/plugins/remark-last-modified.ts b/src/plugins/remark-last-modified.ts index e63a689..cf2277a 100644 --- a/src/plugins/remark-last-modified.ts +++ b/src/plugins/remark-last-modified.ts @@ -5,7 +5,7 @@ export const remarkModifiedTime: RemarkPlugins[number] = () => { return function (_, file) { const filepath = file.history[0]; const command = `git log -1 --pretty="format:%cI" "${filepath}"`; - let result = execSync(command).toString(); + let result = execSync(command).toString().trim(); // File is not in git yet if (result === "") {