diff --git a/build_garden.js b/build_garden.js index 4dad53ac..50818740 100644 --- a/build_garden.js +++ b/build_garden.js @@ -318,4 +318,15 @@ ${entries.join("\n\n")} fd = fs.openSync("site/public/changelog/json", "w+"); fs.writeSync(fd, feed.json1()); fs.closeSync(fd); + + // Update commit info in footer + const commitLink = (await exec(`git log -n 1 --format="https://code.incremental.social/thepaperpilot/pages/commit/%H"`)).stdout.replaceAll(/\n$/g, ''); + const commitTime = (await exec(`git log -n 1 --date=format:"%A, %B %d, %Y at %X" --format=%ad`)).stdout.replaceAll(/\n$/g, ''); + + fd = fs.openSync("site/.vitepress/theme/Layout.vue", "w+"); + let layoutData = fs.readFileSync("site/.vitepress/theme/Layout.vue.in").toString(); + layoutData = layoutData.replace(/COMMIT_LINK/g, commitLink); + layoutData = layoutData.replace(/COMMIT_TIME/g, commitTime); + fs.writeSync(fd, layoutData); + fs.closeSync(fd); })(); diff --git a/site/.vitepress/theme/.gitignore b/site/.vitepress/theme/.gitignore new file mode 100644 index 00000000..3e0cd26a --- /dev/null +++ b/site/.vitepress/theme/.gitignore @@ -0,0 +1 @@ +Layout.vue \ No newline at end of file diff --git a/site/.vitepress/theme/Layout.vue b/site/.vitepress/theme/Layout.vue.in similarity index 66% rename from site/.vitepress/theme/Layout.vue rename to site/.vitepress/theme/Layout.vue.in index f8956383..80a90a70 100644 --- a/site/.vitepress/theme/Layout.vue +++ b/site/.vitepress/theme/Layout.vue.in @@ -8,7 +8,7 @@