hugo-theme-anubis2/layouts/partials/head.html
Quentin Barbe db7e6254fa
Merge style sheets for light and dark themes into a single resource
This will avoid having inline style, which is annoying for stricter CSP.
It should improve performances, as there is only a single file to load.
As a bonus, I also included resource fingerprinting, which will avoid breaking
the cache when it's not needed, and adds subresource integrity checksum.
2020-10-23 13:58:37 +02:00

43 lines
1.7 KiB
HTML

<!-- Basic stuff -->
<meta charset="utf-8">
<meta name="HandheldFriendly" content="True">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="referrer" content="no-referrer-when-downgrade">
<title>{{ if and (.Title) (not .IsHome) }}{{ .Title }} - {{ end }}{{ .Site.Title }}</title>
<meta name="description" content="{{ .Site.Params.Description }}">
{{ with .OutputFormats.Get "rss" -}}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
{{ end -}}
<link rel="icon" type="image/x-icon" href="{{ "favicon.ico" | absURL }}">
<link rel="apple-touch-icon-precomposed" href="{{ "favicon.png" | absURL }}">
{{ $cssTemplate := resources.Get "css/main.css" }}
{{ $style := $cssTemplate | resources.ExecuteAsTemplate "css/style.css" . | resources.ToCSS | resources.Fingerprint "sha256" }}
<link rel="stylesheet" href="{{ $style.Permalink }}" integrity="{{ $style.Data.Integrity }}">
{{ range .Site.Params.customCSS -}}
<link rel="stylesheet" href="{{ . | absURL }}?rnd={{ now.Unix }}">
{{- end }}
{{ range .Site.Params.customJS -}}
<script src="{{ . | absURL }}?rnd={{ now.Unix }}" type="text/javascript" charset="utf-8"></script>
{{- end }}
{{ template "_internal/opengraph.html" . }}
{{ template "_internal/twitter_cards.html" . }}
<!-- Article tags -->
<!-- <meta property="article:published_time" content="">
<meta property="article:modified_time" content="">
<meta property="article:tag" content="">
<meta property="article:publisher" content="https://www.facebook.com/XXX"> -->
{{ if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") }}
{{ template "_internal/google_analytics_async.html" . }}
{{ end }}
{{ partial "head-extra.html" . }}