{{- /* Head Partial - Comprehensive head section template This partial consolidates all head-related content including: - META: Meta tags for SEO, Open Graph, Twitter Cards, and app metadata - LINK: Favicon, canonical links, RSS feeds, and CSS stylesheet loading - SEO: Schema.org structured data for pages and homepage - SCRIPT: Early-loaded scripts (e.g., theme color scheme detection) Called from: base/baseof.html */ -}} {{- $fingerprint := .Site.Store.Get "fingerprint" -}} {{- $cdn := .Site.Store.Get "cdn" | default dict -}} {{- /* ========== META: Meta Tags ========== */ -}} {{- $author := partial "function/get-author-map.html" .Params.author -}} {{- $keywords := .Keywords -}} {{- if not $keywords -}} {{- if .IsPage | and .Params.tags -}} {{- $keywords = .Params.tags -}} {{- else -}} {{- $keywords = .Site.Params.keywords -}} {{- end -}} {{- end -}} {{- with $keywords -}} {{- end -}} {{- template "_internal/schema.html" . -}} {{- template "_internal/opengraph.html" . -}} {{- partial "base/head/twitter-cards.html" . -}} {{- partial "plugin/pagefind-metadata.html" . -}} {{- with .Site.Params.app.theme_color -}} {{- end -}} {{- with .Site.Params.app.tile_color -}} {{- end -}} {{- /* Mastodon Verification */ -}} {{- with .Site.Params.social.mastodon -}} {{- $id := "" -}} {{- $prefix := "https://mastodon.social/" -}} {{- if reflect.IsMap . -}} {{- $id = .id -}} {{- $prefix = .prefix | default $prefix -}} {{- end -}} {{- if $id | and $prefix -}} {{- $link := printf "%s/%s" $prefix $id -}} {{- $email := printf "%s@%s" (strings.TrimPrefix "@" $id) (urls.Parse $prefix).Host -}} {{- end -}} {{- end -}} {{- /* ========== LINK: Favicon, Canonical, Feeds, Stylesheets ========== */ -}} {{- $title := printf "%s %s %s" .Title .Site.Params.title_delimiter .Site.Title -}} {{- if .IsHome -}} {{- $title = .Site.Title -}} {{- end -}} {{- /* Favicon links (static resources, generated via https://realfavicongenerator.net/) */ -}} {{- if not .Site.Params.app.no_favicon -}} {{- $relURL := relURL "" -}} {{- with .Site.Params.app.svg_favicon -}} {{- else -}} {{- end -}} {{- with .Site.Params.app.mask_color -}} {{- end -}} {{- end -}} {{- /* Canonical and pagination links */ -}} {{- with .Prev -}} {{- end -}} {{- with .Next -}} {{- end -}} {{- /* Alternative output formats (Atom, RSS, manifest etc.) */ -}} {{- range .AlternativeOutputFormats -}} {{- if (eq .Name "manifest") | and ( hugo.IsServer | or (not hugo.IsProduction) | or (not $.Site.Params.app.pwa) ) -}} {{- continue -}} {{- end -}} {{- end -}} {{- /* CSS: base + page-specific */ -}} {{- partial "base/head/css.html" . -}} {{- /* Font Awesome Icons */ -}} {{- $source := $cdn.fontawesomeFreeCSS | default "lib/fontawesome-free/all.min.css" -}} {{- $options := dict "Source" $source "Fingerprint" $fingerprint "Preload" true -}} {{- partial "plugin/style.html" $options -}} {{- /* Animate.css Animation Library */ -}} {{- $source := $cdn.animateCSS | default "lib/animate/animate.min.css" -}} {{- $options := dict "Source" $source "Fingerprint" $fingerprint "Preload" true -}} {{- partial "plugin/style.html" $options -}} {{- /* Preload main theme bundle */ -}} {{- $mainResource := dict "Resource" (resources.Get "js/main.ts") "Build" true "Fingerprint" $fingerprint | partial "function/js-build.html" -}} {{- .Site.Store.Set "mainJS" $mainResource -}} {{- /* ========== SEO: Structured Data (Schema.org) ========== */ -}} {{- /* Search Engine Verification */ -}} {{- with .Site.Params.verification.google -}} {{- end -}} {{- with .Site.Params.verification.bing -}} {{- end -}} {{- with .Site.Params.verification.yandex -}} {{- end -}} {{- with .Site.Params.verification.pinterest -}} {{- end -}} {{- with .Site.Params.verification.baidu -}} {{- end -}} {{- with .Site.Params.verification.so -}} {{- end -}} {{- with .Site.Params.verification.sogou -}} {{- end -}} {{- /* Homepage Structured Data */ -}} {{- if .IsHome -}} {{- /* Page (Article) Structured Data */ -}} {{- else if .IsPage -}} {{- $authorName := .Site.Params.author.name | default (T "single.author") -}} {{- with .Params.author -}} {{- if reflect.IsMap . -}} {{- $authorName = cond (isset . "name") .name $authorName -}} {{- else -}} {{- $authorName = . -}} {{- end -}} {{- end -}} {{- $seo := dict "Page" . "Key" "seo" | partial "function/param.html" -}} {{- end -}} {{- /* ========== SCRIPT: Early-Loaded Head Scripts ========== */ -}} {{- /* Theme Color Scheme & Platform Detection (runs before page render) */ -}} {{- $options := dict "targetPath" "js/head.js" -}} {{- $options = dict "defaultTheme" .Site.Params.default_theme | dict "params" | merge $options -}} {{- dict "Source" "js/head/index.ts" "Build" $options "Fingerprint" $fingerprint | partial "plugin/script.html" -}} {{- /* Custom head */ -}} {{- block "custom-head" . }}{{ end -}}