From 68edfb47ac1014f5d992e5b1c19b905bff31de9c Mon Sep 17 00:00:00 2001 From: Bruno Borges Date: Thu, 16 Jul 2026 16:32:07 -0400 Subject: [PATCH] Add GitHub footer to home page Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 3adc4d03-d0c9-40f9-abbe-937931f6c523 --- website/public/github-cookie-consent.js | 48 +++++ website/src/components/Footer.astro | 235 +++++++++++++++++++++++- website/src/components/Head.astro | 3 + 3 files changed, 285 insertions(+), 1 deletion(-) create mode 100644 website/public/github-cookie-consent.js diff --git a/website/public/github-cookie-consent.js b/website/public/github-cookie-consent.js new file mode 100644 index 000000000..c5bda8d28 --- /dev/null +++ b/website/public/github-cookie-consent.js @@ -0,0 +1,48 @@ +(function () { + const assetBase = "https://github.githubassets.com/assets/"; + const assets = [ + "high-contrast-cookie-e99d8801a8e707d0.js", + "wp-runtime-fd4d28ade03ac1d0.js", + "app-runtime-2cb7c64f0defbe9d.js", + "fetch-utilities-7fed68b8333e9826.js", + "78205-5d6a6f402b7a8e68.js", + "89415-812392e4104ab411.js", + "environment-17a3813da72840a4.js", + "runtime-helpers-176627970fd228b1.js", + "catalyst-2b159a120cac7df3.js", + "selector-observer-6cc59d6d6cb4ac45.js", + "relative-time-element-ae9705f9acc73694.js", + "296-4c0a68ac3f1b71d1.js", + "816-8d95115b2deb6077.js", + "21265-6a76b64e3534ad57.js", + "81683-bbf17e7ded27669b.js", + "46740-eafd9231dd2851b5.js", + "30058-00fdf1aae5a3d0d2.js", + "github-elements-3efe2af7b4535ce7.js", + "element-registry-eeff84bbec91d759.js", + ]; + + async function loadAssets() { + for (const asset of assets) { + await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "module"; + script.crossOrigin = "anonymous"; + script.src = assetBase + asset; + script.addEventListener("load", resolve, { once: true }); + script.addEventListener( + "error", + () => reject(new Error("Unable to load " + asset)), + { once: true }, + ); + // Keep GitHub's webpack runtime after Astro's scripts so it derives the + // github.githubassets.com public path for its lazy-loaded consent chunks. + document.body.appendChild(script); + }); + } + } + + loadAssets().catch((error) => { + console.error("Unable to initialize GitHub cookie consent.", error); + }); +})(); diff --git a/website/src/components/Footer.astro b/website/src/components/Footer.astro index 7077d8b8d..2beafa46f 100644 --- a/website/src/components/Footer.astro +++ b/website/src/components/Footer.astro @@ -5,9 +5,12 @@ import Pagination from "@astrojs/starlight/components/Pagination.astro"; import config from "virtual:starlight/user-config"; import { Icon } from "@astrojs/starlight/components"; import ThemeToggle from "./ThemeToggle.astro"; + +const isHomePage = Astro.url.pathname === import.meta.env.BASE_URL; +const currentYear = new Date().getFullYear(); --- -