Update head and anayltics

This commit is contained in:
James Musselman 2024-07-08 19:18:11 -05:00
parent 2a825470c8
commit a31d714e23
No known key found for this signature in database
GPG key ID: 1DAEFF35ECB5D6DB
2 changed files with 62 additions and 0 deletions

View file

@ -0,0 +1,25 @@
{{ if hugo.IsProduction }}
{{ with .Site.Params.fathomAnalytics.site }}
<script defer src="https://cdn.usefathom.com/script.js" data-site="{{ . }}"></script>
{{ end }}
{{ with site.Params.plausibleAnalytics.domain }}
<script
defer
data-domain="{{ . }}"
data-api="{{ default "https://plausible.io/api/event" site.Params.plausibleAnalytics.event }}"
src="{{ default "https://plausible.io/js/script.js" site.Params.plausibleAnalytics.script }}"
></script>
{{ end }}
{{ with site.Params.umamiAnalytics }}
{{- $region := "eu" }}
{{- if isset . "region" }}
{{- $region = .region }}
{{- end }}
<script
defer
src="https://{{ $region }}.umami.is/script.js"
data-website-id="{{ .site }}"
></script>
{{ end }}
{{ template "_internal/google_analytics.html" . }}
{{ end }}

View file

@ -1,5 +1,42 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>{{ if .IsHome }}{{ site.Title }}{{ else }}{{ printf "%s | %s" .Title site.Title }}{{ end }}</title>
{{/* Metadata */}}
<meta
name="description"
content="{{ with .Description }}
{{ . }}
{{ else }}
{{ if .IsPage }}
{{ .Summary }}
{{ else }}
{{ with .Site.Params.description }}{{ . }}{{ end }}
{{ end }}
{{ end }}"
/>
{{ with union .Site.Params.keywords .Params.keywords -}}
<meta name="keywords" content="{{ delimit . `, ` }}" />
{{- end }}
{{ with .Site.Params.robots }}
<meta name="robots" content="{{ . }}" />
{{ end }}
{{ with .Params.robots }}
<meta name="robots" content="{{ . }}" />
{{ end }}
<link rel="canonical" href="{{ .Permalink }}" />
{{ range .AlternativeOutputFormats -}}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .RelPermalink ($.Site.Title | emojify) | safeHTML }}
{{ end -}}
{{/* Icons */}}
{{ if templates.Exists "partials/favicons.html" }}
{{ partialCached "favicons.html" .Site }}
{{ else }}
<link rel="apple-touch-icon" sizes="180x180" href="{{ "apple-touch-icon.png" | relURL }}" />
<link rel="icon" type="image/png" sizes="32x32" href="{{ "favicon-32x32.png" | relURL }}" />
<link rel="icon" type="image/png" sizes="16x16" href="{{ "favicon-16x16.png" | relURL }}" />
<link rel="manifest" href="{{ "site.webmanifest" | relURL }}" />
{{ end }}
{{ partialCached "head/css.html" . }}
{{ partialCached "head/js.html" . }}
{{/* Analytics */}}
{{ partial "analytics.html" . }}