{{ $scr := .Scratch }}
{{/* EXTENSIBILITY HOOK: HEAD-START */}} {{ partial "functions/get_hook" (dict "hook" "head-start" "context" .) }} {{ if .Params.private }} {{- end -}} {{/* Attempt to load superuser/person from data. */}} {{ $superuser_name := "" }} {{ $superuser_slug := "" }} {{ $superuser_role := "" }} {{/* Prefer is_owner flag, fallback to slug 'me' */}} {{ $authors := partialCached "functions/get_authors_data" . site.Language.Lang }} {{ range $slug, $data := $authors }} {{ if and (not $superuser_slug) ($data.is_owner) }} {{ $superuser_slug = $slug }} {{ end }} {{ end }} {{ if and (eq $superuser_slug "") (index $authors "me") }} {{ $superuser_slug = "me" }} {{ end }} {{ if $superuser_slug }} {{ $profile := partial "functions/get_author_profile" (dict "slug" $superuser_slug) }} {{ $superuser_name = $profile.title }} {{ $superuser_role = $profile.role }} {{ end }} {{ $scr.Set "superuser_slug" $superuser_slug }}{{/* Set superuser globally for author rendering. */}} {{ with $superuser_name }}{{ end }} {{/* Generate page description. */}} {{ $desc := "" }} {{ $desc = partial "functions/get_summary" . }} {{ if site.Params.hugoblox.identity.description | and (not $desc) }} {{ $desc = site.Params.hugoblox.identity.description }} {{ end }} {{ if not $desc }} {{ $desc = $superuser_role }} {{ end }} {{ range .Translations }} {{ end }} {{/* Hugo Blox Theme Engine Initialization */}} {{/* Uses get_theme_config helper for backward-compatible config resolution */}} {{ $theme_config := partialCached "functions/get_theme_config" . "theme_config" }} {{ partial "functions/theme_generator.html" $theme_config }} {{/* Demo Theme Pack Styles (if enabled) */}} {{ if site.Params.hugoblox.header.theme_picker }} {{ partial "functions/demo_theme_styles.html" (dict "typography" $theme_config.typography "layout" $theme_config.layout) }} {{ end }} {{/* Tailwind CSS v4 Processing */}} {{/* Use templates.Defer to process CSS after all content is analyzed */}} {{ with (templates.Defer (dict "key" "tailwind-css")) }} {{ partial "css.html" . }} {{ end }} {{ if fileExists "assets/css/custom.css" }} {{ $styles := resources.Get "css/custom.css" | minify | fingerprint "sha256" }} {{ end }} {{/* Externalized init scripts for CSP-friendly head */}} {{- $hb_head := resources.Get "js/hb-head.js" | js.Build | resources.Minify -}} {{- if hugo.IsProduction -}} {{- $hb_head = $hb_head | fingerprint "sha256" -}} {{- end -}} {{/* Analytics & Verification */}} {{/* !CACHED! All analytics and verification code is at site level */}} {{ partialCached "blox-analytics/index" . }} {{/* RSS Feed */}} {{ $branding := partialCached "functions/get_branding" . "branding" }} {{ with .OutputFormats.Get "RSS" }} {{ end }} {{/* Progressive Web App (PWA) Icon - SVG preferred */}} {{ $icon := partial "functions/get_site_icon" 32 }} {{ with $icon.resource }} {{ end }} {{/* Apple Touch Icon - requires PNG */}} {{ $icon_apple := partial "functions/get_site_icon" 180 }} {{ if not $icon_apple.is_svg }} {{ with $icon_apple.resource }} {{ end }} {{ else }} {{/* SVG icon - need PNG fallback for Apple */}} {{ $icon_png := resources.Get "media/icon.png" }} {{ with $icon_png }} {{ $apple_icon := .Fill "180x180 Center" }} {{ end }} {{ end }} {{/* Get page image for sharing. */}} {{ $sharing_image := resources.GetMatch (path.Join "media" "sharing.*") }} {{ $featured_image := partial "functions/get_featured_image" . }} {{ $avatar_image := (.Resources.ByType "image").GetMatch "avatar*" }} {{ $has_logo := fileExists "assets/media/logo.png" | or (fileExists "assets/media/logo.svg") }} {{ $og_image := "" }} {{ $twitter_card := "summary_large_image" }} {{ if and (eq .Kind "term") (eq .Data.Singular "author") }} {{/* Try data-driven avatar for author term pages */}} {{ $termSlug := .Data.Term | urlize }} {{ $profile := partial "functions/get_author_profile" (dict "slug" $termSlug) }} {{ with $profile.avatar }} {{ $og_image = (.Fill "540x540 Center").Permalink }} {{ $twitter_card = "summary" }} {{ end }} {{ else if (and (eq .Kind "term") $avatar_image) }} {{ $og_image = ($avatar_image.Fill "540x540 Center").Permalink }} {{ $twitter_card = "summary" }} {{ else if $featured_image }} {{ $og_image = $featured_image.Permalink }} {{ else if $sharing_image }} {{ $og_image = $sharing_image.Permalink }} {{ else if $has_logo }} {{/* !CACHED! Can safely cache this site logo variant */}} {{ $logo_data := partialCached "functions/get_logo" (dict "constraint" "fit" "size" 300) "logo_og" }} {{ with $logo_data.resource }} {{ $og_image = .Permalink }} {{ end }} {{ $twitter_card = "summary" }} {{ else }} {{ $icon_og := partial "functions/get_site_icon" 512 }} {{ with $icon_og.resource }} {{ $og_image = .Permalink }} {{ end }} {{ $twitter_card = "summary" }} {{ end }} {{ $scr.Set "og_image" $og_image }}{{/* Set `og_image` globally for `rss.xml`. */}} {{ $title := "" }} {{ with .Params.seo.title }} {{ $title = replace . "{brand}" $branding.site_title }} {{ else }} {{ $title = .Title | default $branding.site_title }} {{ if ne $title $branding.site_title }}{{ $title = printf "%s | %s" $title $branding.site_title }}{{ end }} {{ end }} {{ with site.Params.hugoblox.identity.social.twitter }} {{ end }} {{- with $og_image -}} {{- end -}} {{ if .IsPage }} {{ if not .PublishDate.IsZero }} {{ else if not .Date.IsZero }} {{ end }} {{ if not .Lastmod.IsZero }}{{ end }} {{ else }} {{ if not .Date.IsZero }} {{ end }} {{ end }} {{ partial "jsonld/main" (dict "page" . "summary" $desc) }}