feat: display last modified and wordcount on article
This commit is contained in:
parent
f8d69ac954
commit
666349c5b8
2 changed files with 11 additions and 5 deletions
|
@ -1,10 +1,9 @@
|
|||
import { execSync } from "child_process";
|
||||
import { statSync } from "node:fs";
|
||||
import {execSync} from "child_process";
|
||||
import {statSync} from "node:fs";
|
||||
|
||||
export function remarkModifiedTime() {
|
||||
return function (tree, file) {
|
||||
const filepath = file.history[0];
|
||||
const result = execSync(`git log -1 --pretty="format:%cI" "${filepath}"`).toString() || statSync(filepath).mtime.toISOString();
|
||||
file.data.astro.frontmatter.lastModified = result.toString();
|
||||
file.data.astro.frontmatter.lastModified = execSync(`git log -1 --pretty="format:%cI" "${filepath}"`).toString() || statSync(filepath).mtime.toISOString();
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue