mirror of
https://gitlab.com/ansol/web-ansol.org.git
synced 2024-11-25 15:43:17 +00:00
173 lines
8.5 KiB
HTML
173 lines
8.5 KiB
HTML
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
|
|
<meta name="author" content="ANSOL - Associação Nacional para o Software Livre">
|
|
|
|
{{ $scr := .Scratch }}
|
|
{{/* 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 }}
|
|
{{ end }}
|
|
<meta name="description" content="{{ $desc }}">
|
|
|
|
{{ partial "functions/parse_theme" . }}
|
|
{{ $css := site.Data.assets.css }}
|
|
{{ $js := site.Data.assets.js }}
|
|
{{ if ne ($scr.Get "primary") "#fff" }}
|
|
<meta name="theme-color" content="{{ $scr.Get "primary" }}">
|
|
{{ end }}
|
|
|
|
{{/* Config LaTeX math rendering. */}}
|
|
{{ if or .Params.math site.Params.math }}
|
|
{{ $mathjax_config := resources.Get "js/mathjax-config.js" }}
|
|
<script src="{{ $mathjax_config.RelPermalink }}"></script>
|
|
{{ end }}
|
|
|
|
{{ $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 "<link rel=\"stylesheet\" href=\"%s\" crossorigin=\"anonymous\" title=\"hl-light\">" (printf $css.highlight.url $css.highlight.version .) | safeHTML }}
|
|
{{ printf "<link rel=\"stylesheet\" href=\"%s\" crossorigin=\"anonymous\" title=\"hl-dark\" disabled>" (printf $css.highlight.url $css.highlight.version .) | safeHTML }}
|
|
{{ else }}
|
|
{{ if eq ($scr.Get "light") true }}
|
|
{{ printf "<link rel=\"stylesheet\" href=\"%s\" crossorigin=\"anonymous\" title=\"hl-light\">" (printf $css.highlight.url $css.highlight.version "github") | safeHTML }}
|
|
{{ printf "<link rel=\"stylesheet\" href=\"%s\" crossorigin=\"anonymous\" title=\"hl-dark\" disabled>" (printf $css.highlight.url $css.highlight.version "dracula") | safeHTML }}
|
|
{{ else }}
|
|
{{ printf "<link rel=\"stylesheet\" href=\"%s\" crossorigin=\"anonymous\" title=\"hl-light\" disabled>" (printf $css.highlight.url $css.highlight.version "github") | safeHTML }}
|
|
{{ printf "<link rel=\"stylesheet\" href=\"%s\" crossorigin=\"anonymous\" title=\"hl-dark\">" (printf $css.highlight.url $css.highlight.version "dracula") | safeHTML }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ if or (eq site.Params.map.engine 2) (eq site.Params.map.engine 3) }}
|
|
{{ printf "<link rel=\"stylesheet\" href=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\">" (printf $css.leaflet.url $css.leaflet.version) $css.leaflet.sri | safeHTML }}
|
|
{{ end }}
|
|
|
|
{{ if eq site.Params.search.engine 2 }}
|
|
{{ printf "<link rel=\"stylesheet\" href=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\">" (printf $css.instantsearch.url $css.instantsearch.version) $css.instantsearch.sri | safeHTML }}
|
|
{{ printf "<link rel=\"stylesheet\" href=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\">" (printf $css.instantsearchTheme.url $css.instantsearchTheme.version) $css.instantsearchTheme.sri | safeHTML }}
|
|
{{ end }}
|
|
|
|
{{/* Load async scripts. */}}
|
|
{{ range $k, $v := site.Data.assets.js }}{{/* TODO: investigate why `where ... "async" true` does not work. */}}
|
|
{{ $load := $v.async }}
|
|
|
|
{{/* Only load MathJax if required. */}}
|
|
{{ if (eq $k "mathJax") | and (not (or $.Params.math site.Params.math)) }}
|
|
{{ $load = false }}
|
|
{{end}}
|
|
|
|
{{ if $load }}
|
|
{{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\" async></script>" (printf $v.url $v.version) $v.sri | safeHTML }}
|
|
{{end}}
|
|
{{end}}
|
|
|
|
{{/* We cannot use SRI with Google Fonts because the CSS is dynamically generated according to the user agent. */}}
|
|
{{/* Hugo's htmlEscape cannot escape "|" in Google Font URIs so we implement our own escape functionality. */}}
|
|
{{ with ($scr.Get "google_fonts") }}
|
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat:400,700%7CRoboto:100,300,400,400italic,700%7CRoboto+Mono&display=swap">
|
|
<link rel="stylesheet" {{ printf "href=\"https://fonts.googleapis.com/css?family=%s&display=swap\"" . | replaceRE "\\|" "%7C" | safeHTMLAttr }}>
|
|
{{ end }}
|
|
|
|
{{ $css_options := dict "targetPath" "css/academic.css" }}
|
|
{{- if (in (slice (getenv "HUGO_ENV") hugo.Environment) "production") -}}
|
|
{{- $css_options = merge $css_options (dict "outputStyle" "compressed") -}}
|
|
{{- end -}}
|
|
{{ $sass_template := resources.Get "scss/ansol.scss" }}
|
|
{{ $style := $sass_template | resources.ExecuteAsTemplate "ansol_parsed.scss" . | toCSS $css_options }}
|
|
{{- if (eq (getenv "HUGO_ENV") "production") -}}
|
|
{{- $style = $style | minify | fingerprint "md5" -}}
|
|
{{- end -}}
|
|
<link rel="stylesheet" href="{{ $style.RelPermalink }}">
|
|
|
|
{{ partial "marketing/google_analytics" . }}
|
|
{{ partial "marketing/google_tag_manager" . }}
|
|
|
|
{{/* Netlify Identity integration. */}}
|
|
{{ if .IsHome | and (site.Params.cms.netlify_cms | default true) }}
|
|
<script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>
|
|
{{ end }}
|
|
|
|
{{ with .OutputFormats.Get "RSS" }}
|
|
<link rel="alternate" href="{{.RelPermalink}}" type="application/rss+xml" title="{{site.Title}}">
|
|
{{ end }}
|
|
|
|
<link rel="manifest" href="{{ "index.webmanifest" | relLangURL }}">
|
|
<link rel="icon" type="image/png" href="{{(partial "functions/get_icon" 32).RelPermalink}}">
|
|
<link rel="apple-touch-icon" type="image/png" href="{{(partial "functions/get_icon" 192).RelPermalink}}">
|
|
|
|
<link rel="canonical" href="{{ .Permalink }}">
|
|
|
|
{{/* Get page image for sharing. */}}
|
|
{{ $featured_image := (.Resources.ByType "image").GetMatch "*featured*" }}
|
|
{{ $avatar_image := (.Resources.ByType "image").GetMatch "avatar*" }}
|
|
{{ $has_logo := fileExists "assets/images/logo.png" | or (fileExists "assets/images/logo.svg") }}
|
|
{{ $og_image := "" }}
|
|
{{ $twitter_card := "summary_large_image" }}
|
|
{{ if (and (eq .Kind "taxonomy") $avatar_image) }}
|
|
{{ $og_image = ($avatar_image.Fill "270x270 Center").Permalink }}{{/* Match image proc in About widget. */}}
|
|
{{ $twitter_card = "summary" }}
|
|
{{ else 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 $has_logo }}
|
|
{{ $og_image = (partial "functions/get_logo" (dict "constraint" "fit" "size" 300)).Permalink }}
|
|
{{ $twitter_card = "summary" }}
|
|
{{ else }}
|
|
{{ $og_image = (partial "functions/get_icon" 512).Permalink }}
|
|
{{ $twitter_card = "summary" }}
|
|
{{ end }}
|
|
{{ $scr.Set "og_image" $og_image }}{{/* Set `og_image` globally for `rss.xml`. */}}
|
|
<meta property="twitter:card" content="{{ $twitter_card }}">
|
|
{{ with site.Params.twitter }}
|
|
<meta property="twitter:site" content="@{{ . }}">
|
|
<meta property="twitter:creator" content="@{{ . }}">
|
|
{{ end }}
|
|
<meta property="og:site_name" content="{{ site.Title }}">
|
|
<meta property="og:url" content="{{ .Permalink }}">
|
|
<meta property="og:title" content="{{ if not .IsHome }}{{ .Title }} | {{ end }}{{ site.Title }}">
|
|
<meta property="og:description" content="{{ $desc }}">
|
|
{{- with $og_image -}}
|
|
<meta property="og:image" content="{{.}}">
|
|
<meta property="twitter:image" content="{{.}}">
|
|
{{- end -}}
|
|
<meta property="og:locale" content="{{ site.LanguageCode | default "en-us" }}">
|
|
{{ if .IsPage }}
|
|
{{ if not .PublishDate.IsZero }}
|
|
<meta property="article:published_time" content="{{ .PublishDate.Format "2006-01-02T15:04:05-07:00" | safeHTML }}">
|
|
{{ else if not .Date.IsZero }}
|
|
<meta property="article:published_time" content="{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}">
|
|
{{ end }}
|
|
{{ if not .Lastmod.IsZero }}<meta property="article:modified_time" content="{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }}">{{ end }}
|
|
{{ else }}
|
|
{{ if not .Date.IsZero }}<meta property="og:updated_time" content="{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}">{{ end }}
|
|
{{ end }}
|
|
|
|
{{ partial "jsonld/main" (dict "page" . "summary" $desc) }}
|
|
|
|
{{ partial "cookie_consent" . }}
|
|
|
|
{{ partial "custom_head" . }}
|
|
|
|
<title>{{ if not .IsHome }}{{ .Title }} | {{ end }}{{ site.Title }}</title>
|
|
|
|
</head>
|