{{ hugo.Generator}} {{ $scr := .Scratch }} {{/* Attempt to load superuser. */}} {{ $superuser_name := "" }} {{ $superuser_username := "" }} {{ $superuser_role := "" }} {{ range first 1 (where (where site.Pages "Section" "authors") "Params.superuser" true) }} {{ $superuser_name = .Params.name }} {{ $superuser_username = path.Base (path.Split .Path).Dir }} {{ $superuser_role = .Params.role }} {{ end }} {{ $scr.Set "superuser_username" $superuser_username }}{{/* For access from page_author.html. */}} {{ with $superuser_name }}{{ end }} {{/* Generate page description. */}} {{ $desc := "" }} {{ if .Params.summary }} {{ $desc = .Params.summary }} {{ else if .Params.abstract }} {{ $desc = .Params.abstract }} {{ else if .IsPage }} {{ $desc = .Summary }} {{ else if site.Params.description }} {{ $desc = site.Params.description }} {{ else }} {{ $desc = $superuser_role }} {{ end }} {{ range .Translations }} {{ end }} {{ partial "functions/parse_theme" . }} {{ $css := site.Data.assets.css }} {{ $js := site.Data.assets.js }} {{ if ne ($scr.Get "primary") "#fff" }} {{ end }} {{/* Attempt to load local vendor CSS, otherwise load from CDN. */}} {{ $scr.Set "vendor_css_filename" "main.min.css" }} {{ $scr.Set "vendor_js_filename" "main.min.js" }} {{ if and (fileExists (printf "static/css/vendor/%s" ($scr.Get "vendor_css_filename"))) (fileExists (printf "static/js/vendor/%s" ($scr.Get "vendor_js_filename"))) }} {{ $scr.Set "use_cdn" 0 }} {{ else }} {{ $scr.Set "use_cdn" 1 }} {{ printf "" (printf $css.academicons.url $css.academicons.version) $css.academicons.sri | safeHTML }} {{ printf "" (printf $css.fontAwesome.url $css.fontAwesome.version) $css.fontAwesome.sri | safeHTML }} {{ printf "" (printf $css.fancybox.url $css.fancybox.version) $css.fancybox.sri | safeHTML }} {{/* Default to enabling highlighting, but allow the user to override it in .Params or site.Params. Use $scr to store "highlight_enabled", so that we can read it again in footer.html. */}} {{ $scr.Set "highlight_enabled" true }} {{ if isset .Params "highlight" }} {{ $scr.Set "highlight_enabled" .Params.highlight }} {{ else if isset site.Params "highlight" }} {{ $scr.Set "highlight_enabled" site.Params.highlight }} {{ end }} {{ if ($scr.Get "highlight_enabled") }} {{ $v := $css.highlight.version }} {{ with site.Params.highlight_style }} {{ printf "" (printf $css.highlight.url $css.highlight.version .) | safeHTML }} {{ printf "" (printf $css.highlight.url $css.highlight.version .) | safeHTML }} {{ else }} {{ if eq ($scr.Get "light") true }} {{ printf "" (printf $css.highlight.url $css.highlight.version "github") | safeHTML }} {{ printf "" (printf $css.highlight.url $css.highlight.version "dracula") | safeHTML }} {{ else }} {{ printf "" (printf $css.highlight.url $css.highlight.version "github") | safeHTML }} {{ printf "" (printf $css.highlight.url $css.highlight.version "dracula") | safeHTML }} {{ end }} {{ end }} {{ end }} {{ if or (eq site.Params.map 2) (eq site.Params.map 3) }} {{ printf "" (printf $css.leaflet.url $css.leaflet.version) $css.leaflet.sri | safeHTML }} {{ end }} {{ if eq site.Params.search.engine 2 }} {{ printf "" (printf $css.instantsearch.url $css.instantsearch.version) $css.instantsearch.sri | safeHTML }} {{ printf "" (printf $css.instantsearchTheme.url $css.instantsearchTheme.version) $css.instantsearchTheme.sri | safeHTML }} {{ end }} {{ end }} {{/* We cannot use SRI with Google Fonts because the CSS is dynamically generated according to the user agent. */}} {{ with ($scr.Get "google_fonts") }} {{ end }} {{ $css_options := (dict "targetPath" "css/academia.css" "outputStyle" "compressed") }} {{ $sass_template := resources.Get "sass/main.scss" }} {{ $style := $sass_template | resources.ExecuteAsTemplate "main_parsed.scss" . | toCSS $css_options | minify | fingerprint "md5" }} {{ if site.Params.plugins_css }} {{ $css_comment := printf "/* Source Themes academia v%s | https://sourcethemes.com/academic/ */\n" site.Data.academia.version }} {{ $css_bundle_head := $css_comment | resources.FromString "css/bundle-head.css" }} {{ $css_bundle := slice }} {{ range site.Params.plugins_css }} {{ $css_bundle = $css_bundle | append (resources.Get (printf "css/%s.css" .)) }} {{ end }} {{ $css_bundle := $css_bundle | resources.Concat "css/academia-bundle-pre.css" | minify }} {{ $css_bundle := slice $css_bundle_head $css_bundle | resources.Concat "css/academia.css" | fingerprint "md5" }} {{ end }} {{ if not site.IsServer }} {{ if site.Params.microsoft_clarity }} {{ end }} {{ if site.GoogleAnalytics }} {{ if ($scr.Get "use_cdn") }} {{ printf "" (printf $js.autotrack.url $js.autotrack.version) $js.autotrack.sri | safeHTML }} {{ end }} {{ end }} {{ end }} {{ with .OutputFormats.Get "RSS" }} {{ end }} {{ $featured_image := (.Resources.ByType "image").GetMatch "*featured*" }} {{ $og_image := "" }} {{ $twitter_card := "summary_large_image" }} {{ if $featured_image }} {{ $og_image = $featured_image.Permalink }} {{ else if .Params.header.image }} {{ $og_image = printf "img/%s" .Params.header.image | absURL }} {{ else if site.Params.sharing_image }} {{ $og_image = printf "img/%s" site.Params.sharing_image | absURL }} {{ else if site.Params.avatar }} {{ $og_image = (printf "img/%s" site.Params.avatar) | absURL }} {{ $twitter_card = "summary" }} {{ else }} {{ $og_image = "img/icon-192.png" | absURL }} {{ $twitter_card = "summary" }} {{ end }} {{ with site.Params.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 "cookie_consent" . }} {{ partial "custom_head" . }}