Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
Add a docs site build version indicator in the footer. (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
wyhaines authored Mar 6, 2024
1 parent 6d888a8 commit 09f4275
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions gatsby-node.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import createPages from './src/gatsby/createPages';
import onCreateNode from './src/gatsby/onCreateNode';
import onPreBuild from './src/gatsby/onPreBuild';

module.exports = {
createPages,
onCreateNode,
onPreBuild,
};
3 changes: 2 additions & 1 deletion src/components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export const Footer: React.FC = () => {
</ul>
</nav>
)}
<span>© 2023 All rights reserved zk Foundation</span>
<span>© 2024 All rights reserved zk Foundation</span>
<span style={{fontSize: "0.85em"}}>Build {process.env.GATSBY_GIT_SHA}{process.env.GATSBY_BUILD_DATE}</span>
</div>
</footer>
);
Expand Down
2 changes: 2 additions & 0 deletions src/components/layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ export const Head = ({ pageContext }: PageNode) => {
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content={config.twitterName} />
<meta name="og:site_name" content={config.title} />
<meta name="publish-date" content={process.env.GATSBY_BUILD_DATE} />
<meta name="version" content={process.env.GATSBY_GIT_SHA} />
</>
);
};
Expand Down
8 changes: 8 additions & 0 deletions src/gatsby/onPreBuild.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { execSync } from 'child_process';

const onPreBuild = async () => {
process.env.GATSBY_BUILD_DATE = new Date().toISOString();
process.env.GATSBY_GIT_SHA = execSync('git rev-parse HEAD').toString().trim().substring(0,8);
};

export default onPreBuild;

0 comments on commit 09f4275

Please sign in to comment.