Add git commit hash with link to footer component

This commit is contained in:
Erica Marigold 2024-07-06 21:57:01 +05:30
parent a1aea63099
commit 675338a7bb
No known key found for this signature in database
GPG key ID: 2768CC0C23D245D1
3 changed files with 15 additions and 2 deletions

View file

@ -6,7 +6,7 @@
"prepare": "npmluau",
"dev": "astro dev",
"start": "astro dev",
"build": "astro build && pagefind --site dist",
"build": "COMMIT_HASH=`git rev-parse --short HEAD` astro build && pagefind --site dist",
"preview": "astro preview",
"astro": "astro",
"new-post": "lune run new-post",

View file

@ -1,12 +1,17 @@
---
import { profileConfig } from "../config";
const COMMIT_HASH = import.meta.env.COMMIT_HASH;
const COMMIT_HASH_URL = COMMIT_HASH
? `https://github.com/CompeyDev/blog.devcomp.xyz/commit/${COMMIT_HASH}`
: null;
---
<div class="card-base max-w-[var(--page-width)] min-h-[4.5rem] rounded-b-none mx-auto flex items-center px-6">
<div class="transition text-50 text-sm">
© 2024 {profileConfig.name}. All Rights Reserved.
<br>
Powered by <a class="link text-[var(--primary)] font-medium" target="_blank" href="https://github.com/saicaca/fuwari">Fuwari</a>
Powered by <a class="link text-[var(--primary)] font-medium" target="_blank" href="https://github.com/saicaca/fuwari">Fuwari</a> - <a class="link text-[var(--primary)] font-medium" target="_blank" href={COMMIT_HASH_URL}>{COMMIT_HASH ?? "dev"}</a>
</div>
</div>

8
src/env.d.ts vendored
View file

@ -1,2 +1,10 @@
/// <reference types="astro/client" />
/// <reference path="../.astro/types.d.ts" />
interface ImportMetaEnv {
readonly COMMIT_HASH?: string;
}
interface ImportMeta {
readonly env: ImportMetaEnv;
}