mirror of
https://git.sr.ht/~seirdy/seirdy.one
synced 2024-11-24 05:02:10 +00:00
74e939f40b
Use Hugo's fingerprinting pipes [0] to give external stylesheets an identifier to enable cache-busting [1]. Since Hugo's fingerprinting automatically generates the information needed for SRI [2], include an integrity attribute too. I discovered this feature through webhint [3], and added the .hintrc file I used to the repo root. [0]: https://gohugo.io/hugo-pipes/fingerprint/ [1]: https://css-tricks.com/strategies-for-cache-busting-css/ [2]: https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity [3]: https://webhint.io/
32 lines
1.6 KiB
HTML
32 lines
1.6 KiB
HTML
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
{{ with .Site.Params.description -}}
|
|
<meta name="description" content="{{ . }}">
|
|
{{ end }}
|
|
{{ printf `<link rel="shortcut icon" href="%s">` ("favicon.png" | absURL) | safeHTML }}
|
|
<link href="{{ .Site.BaseURL }}posts/index.xml" rel="alternate" type="application/rss+xml" title="{{ $.Site.Title }}"/>
|
|
{{ if eq .Site.BaseURL "https://envs.net/~seirdy/" -}}
|
|
<meta name="robots" content="noindex">
|
|
{{ end -}}
|
|
<link rel="canonical" href="https://seirdy.one{{ .RelPermalink }}"/>
|
|
{{ $resources := slice -}}
|
|
{{ $resources = $resources | append (resources.Get "/css/main.css") -}}
|
|
{{ $resources = $resources | append (resources.Get "/css/narrow.css") -}}
|
|
{{ $dark := .Site.Params.dark | default "auto" -}}
|
|
{{ if not (eq $dark "off") -}}
|
|
{{ $resources = $resources | append (resources.Get "css/dark.css" | resources.ExecuteAsTemplate "dark.css" .) -}}
|
|
{{ end -}}
|
|
{{ $css := $resources | resources.Concat "css/style.css" | minify | resources.Fingerprint "sha384" -}}
|
|
{{ printf `<link rel="stylesheet" href="%s" integrity="%s">` $css.RelPermalink $css.Data.Integrity | safeHTML }}
|
|
{{ if .Params.highlight -}}
|
|
{{ $css_syntax := resources.Get "/css/syntax.css" | minify | resources.Fingerprint "sha384" }}
|
|
{{- printf `<link rel="stylesheet" href="%s" integrity="%s">` $css_syntax.RelPermalink $css_syntax.Data.Integrity | safeHTML }}
|
|
{{ end -}}
|
|
|
|
{{ if eq .RelPermalink "/" -}}
|
|
<title>{{ .Title }}</title>
|
|
{{ else -}}
|
|
<title>{{ .Title }} - Seirdy</title>
|
|
{{ end -}}
|
|
</head>
|