site/layouts/partials/head.html

50 lines
1.8 KiB
HTML

<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
{{ with .Description }}
<meta name="description" content="{{ . }}" />
{{ else }}
{{ if .IsPage }}
<meta name="description" content="{{ .Summary }}" />
{{ else }}
{{ with site.Params.description }}
<meta name="description" content="{{ . }}" />
{{ end }}
{{ end }}
{{ end }}
<title>
{{- if eq .Title site.Title -}}
{{ site.Title }}
{{- else -}}
{{ with .Title }}{{ . }} | {{ end }}{{ site.Title }}
{{- end -}}
</title>
<link rel="canonical" href="{{ .Permalink }}" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
{{ range .AlternativeOutputFormats }}
{{ printf "<link rel=%q type=%q href=%q title=%q />" .Rel .MediaType .Permalink site.Title | safeHTML }}
{{ end }}
{{ $scss_options := dict "transpiler" "dartsass" }}
{{ with resources.Get "css/main.tpl.scss" | resources.ExecuteAsTemplate "css/main.scss" . | resources.ToCSS $scss_options | minify | fingerprint }}
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous" />
{{ end }}
{{ with .Params.css }}
{{ with resources.GetMatch (.) | minify | fingerprint }}
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous" />
{{ end }}
{{ end }}
{{/*
https://developer.mozilla.org/en-US/docs/Web/Performance/Lazy_loading#fonts
NOTE: fonts/ directory is symlinked from static/ to assets/ to make the .Resources.Match work
*/}}
{{ range resources.Match "/fonts/iosevka-aile*.woff2" }}
<link rel="preload" href="{{ . | relURL }}" as="font" type="font/woff2" crossorigin="anonymous" />
{{ end }}
</head>