{{- /* 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.themeColor -}} {{- $color := . -}} {{- if ne (len $color) 2 -}} {{- $color = dict "light" . "dark" . -}} {{- end -}} {{- end -}} {{- with .Site.Params.app.tileColor -}} {{- 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.titleDelimiter .Site.Title -}} {{- if .IsHome -}} {{- $title = .Site.Title -}} {{- end -}} {{- /* Favicon links (static resources, generated via https://realfavicongenerator.net/) */ -}} {{- if not .Site.Params.app.noFavicon -}} {{- $relURL := relURL "" -}} {{- with .Site.Params.app.svgFavicon -}} {{- else -}} {{- end -}} {{- with .Site.Params.app.iconColor -}} {{- end -}} {{- if eq .Site.Params.enablePWA true -}} {{- end -}} {{- end -}} {{- /* Canonical and pagination links */ -}} {{- with .Prev -}} {{- end -}} {{- with .Next -}} {{- end -}} {{- /* Alternative output formats (Atom, RSS, etc.) */ -}} {{- range .AlternativeOutputFormats -}} {{- printf `` .Rel .MediaType.Type .Permalink $title | safeHTML -}} {{- end -}} {{- /* JSON Feed support */ -}} {{- with .OutputFormats.Get "jsonfeed" -}} {{- end -}} {{- /* Config CSS */ -}} {{- dict "Source" "scss/config.template.scss" "Template" "scss/config.scss" "ToCSS" (dict "enableSourceMap" false) "Fingerprint" $fingerprint "Context" . | partial "plugin/style.html" -}} {{- /* Theme main CSS */ -}} {{- $mainCSS := dict "Resource" (resources.Get "scss/main.scss") "ToCSS" true "Fingerprint" $fingerprint | partial "function/to-css.html" -}} {{- .Site.Store.Set "mainCSS" $mainCSS -}} {{- dict "Resource" $mainCSS | partial "plugin/style.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) ========== */ -}} {{- $params := partial "function/params.html" -}} {{- /* 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 -}} {{- 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.defaulttheme | dict "params" | merge $options -}} {{- dict "Source" "js/head/index.ts" "Build" $options "Fingerprint" $fingerprint | partial "plugin/script.html" -}} {{- /* Custom head */ -}} {{- block "custom-head" . }}{{ end -}}