Add global components

This commit is contained in:
Korbs 2024-06-07 03:17:00 -04:00
parent 8595bb49e8
commit ea57742e70
3 changed files with 83 additions and 0 deletions

View file

@ -0,0 +1,42 @@
---
// Environment Variables
import {
ANALYTICS,
MATOMO_ID,
MATOMO_SRC,
PLAUSIBLE_DOMAIN,
PLAUSIBLE_SRC,
UMAMI_ID,
UMAMI_SRC,
AMPLITUDE_APIKEY
} from '@utils/GetConfig'
// Get Astro Analytics
import {
Fathom,
Metrical,
Plausible,
SimpleAnalytics,
Umami,
Amplitude,
Matomo,
MinimalAnalytics
} from 'astro-analytics';
---
<!-- https://gist.sudovanilla.org/Korbs/fac0f5b99a6e43679c1d38d614721b5e -->
{
()=> {
if (ANALYTICS === "None") {
return null
} else if (ANALYTICS === "Plausible") {
<Plausible domain={PLAUSIBLE_DOMAIN} src={PLAUSIBLE_SRC + "/yoursript.js"} />
} else if (ANALYTICS === "Umami") {
<Umami id="4fb7fa4c-5b46-438d-94b3-3a8fb9bc2e8b" src={UMAMI_SRC + "/umami.js"} />
} else if (ANALYTICS === "Amplitude") {
<Amplitude apiKey={AMPLITUDE_APIKEY} />
} else if (ANALYTICS === "Matomo") {
<Matomo id={MATOMO_ID} src={MATOMO_SRC} />
}
}
}

View file

@ -0,0 +1,24 @@
---
// Properties
const { Title } = Astro.props;
// Components
import Analytics from "@components/global/Analytics.astro"
---
<head>
<!-- Metadata -->
<title>{Title}</title>
<!-- tells dark reader that the site has a dark theme and to turn itself off -->
<meta name="darkreader-lock" />
<!-- Options -->
<meta charset="UTF-8" />
<meta name="theme-color" content="#000000" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no, viewport-fit=cover" />
<!-- Favicon -->
<link rel="apple-touch-icon" href="favicon.svg" />
<link rel="icon" href="favicon.svg" />
<Analytics/>
</head>

View file

@ -0,0 +1,17 @@
---
// Environment Variables
import {
SITE_NAME,
META_COLOR,
COLOR,
THEME
} from '@utils/GetConfig'
---
<header>
<div class="header-content">
<div class="start">
<h2><a style="text-decoration: none;" href="/">{SITE_NAME}</a></h2>
</div>
</div>
</header>