Skip to content

Commit

Permalink
feat: add current commit to footer
Browse files Browse the repository at this point in the history
  • Loading branch information
powercasgamer committed Jun 16, 2024
1 parent 442ddd0 commit 62b63c3
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion config/footer.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
import type { Footer } from "@docusaurus/theme-common";
import { execSync } from "child_process";
import { Icon } from "@iconify/react";

let currentCommit: string;
try {
currentCommit = execSync('git rev-parse HEAD')
.toString().slice(0, 7).trim();
} catch (error) {
console.error('Failed to get the current commit:', error);
currentCommit = 'unknown';
}

const footer: Footer = {
style: "dark",
Expand Down Expand Up @@ -47,7 +58,7 @@ const footer: Footer = {
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} PaperMC and Contributors. Built with Docusaurus.`,
copyright: `Copyright © ${new Date().getFullYear()} PaperMC and Contributors. Built with Docusaurus.<br><Icon icon="mdi:archive" /> <a href="https://github.com/PaperMC/docs/">PaperMC/docs</a> @ <a href="https://github.com/PaperMC/docs/commit/${currentCommit}">${currentCommit}</a>`,
};

export default footer;

0 comments on commit 62b63c3

Please sign in to comment.