mirror of
https://git.sr.ht/~seirdy/seirdy.one
synced 2024-11-23 21:02:09 +00:00
Optimize head size
- apple-touch-icon not needed, will be fetched from doc root - re-order <head> elements to optimize for compression algorithm size savings. shaved off like 15 bytes. this was a good use of my time.
This commit is contained in:
parent
f8d4b6170d
commit
2bf7359303
2 changed files with 25 additions and 29 deletions
2
Makefile
2
Makefile
|
@ -3,7 +3,7 @@ DEVSERVER_URL="http://localhost:1313/"
|
||||||
|
|
||||||
DOMAIN = seirdy.one
|
DOMAIN = seirdy.one
|
||||||
HUGO_BASEURL = "https://$(DOMAIN)/"
|
HUGO_BASEURL = "https://$(DOMAIN)/"
|
||||||
HUGO_FLAGS += --gc
|
HUGO_FLAGS += --gc --minify
|
||||||
USER = deploy@$(DOMAIN)
|
USER = deploy@$(DOMAIN)
|
||||||
WWW_ROOT = /var/www/$(DOMAIN)
|
WWW_ROOT = /var/www/$(DOMAIN)
|
||||||
GEMINI_ROOT = /srv/gemini/$(DOMAIN)
|
GEMINI_ROOT = /srv/gemini/$(DOMAIN)
|
||||||
|
|
|
@ -2,42 +2,43 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta name="description" content="{{ if .Params.description }}{{ .Params.description }}{{ else }}{{ .Site.Params.Description }}{{ end }}">
|
<meta name="description" content="{{ if .Params.description }}{{ .Params.description }}{{ else }}{{ .Site.Params.Description }}{{ end }}">
|
||||||
<meta name="author" content="{{ .Site.Author.name }}">
|
<meta content="{{ .Site.Author.name }}" name="author">
|
||||||
|
<meta property="article:author" content="{{ .Site.Author.name }}">
|
||||||
|
<meta property="article:published_time" content="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">
|
||||||
|
{{ if lt .Date .Lastmod -}}
|
||||||
|
<meta property="article:modified_time" content="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}">
|
||||||
|
{{ end -}}
|
||||||
{{ $icon_192 := resources.Get "/apple-touch-icon.png" | resources.Fingerprint "md5" }}
|
{{ $icon_192 := resources.Get "/apple-touch-icon.png" | resources.Fingerprint "md5" }}
|
||||||
{{- printf `<link rel="icon" sizes="192x192" href="%s" type="image/png">` $icon_192.RelPermalink | safeHTML -}}
|
{{- printf `<link rel="icon" sizes="192x192" href="%s" type="image/png">` $icon_192.RelPermalink | safeHTML -}}
|
||||||
{{ $favicon := resources.Get "/favicon.png" -}}
|
{{ $favicon := resources.Get "/favicon.png" -}}
|
||||||
{{ $favicon_base64 := $favicon.Content | base64Encode }}
|
{{ $favicon_base64 := $favicon.Content | base64Encode }}
|
||||||
{{ printf `<link rel="icon" sizes="32x32" href="data:image/png;base64,%s" type="image/png">` $favicon_base64 | safeHTML -}}
|
{{ printf `<link rel="icon" sizes="32x32" href="data:image/png;base64,%s" type="image/png">` $favicon_base64 | safeHTML -}}
|
||||||
<!-- apple-touch-icon used to be apple-specific, but now it's
|
|
||||||
a pseudo-standard relied upon by other vendors too:
|
|
||||||
https://html.spec.whatwg.org/multipage/semantics.html#attr-link-sizes -->
|
|
||||||
{{ printf `<link rel="apple-touch-icon" href="%s">` $icon_192.RelPermalink | safeHTML -}}
|
|
||||||
<!-- Why does apple do this -->
|
<!-- Why does apple do this -->
|
||||||
<meta name="format-detection" content="telephone=no">
|
<meta name="format-detection" content="telephone=no">
|
||||||
|
<meta name="color-scheme" content="light dark">
|
||||||
|
<meta name="theme-color" content="#0d0d0d" media="(prefers-color-scheme:dark)">
|
||||||
|
<meta name="theme-color" content="#fff" media="(prefers-color-scheme:light)">
|
||||||
|
{{- if and (ne .Site.BaseURL "https://seirdy.one/") (ne .Site.BaseURL "http://wgq3bd2kqoybhstp77i3wrzbfnsyd27wt34psaja4grqiezqircorkyd.onion/") -}}
|
||||||
|
<!-- Don't index the tildeverse mirror, staging site, etc. -->
|
||||||
|
<meta name="robots" content="noindex">
|
||||||
|
{{- else -}}
|
||||||
|
<!-- IDC how much content is extracted from my pages, go knock yourself out. huge images, long snippets, whatever. -->
|
||||||
|
<meta name="robots" content="max-image-preview:large,max-snippet=-1">
|
||||||
|
<link href="https://seirdy.one/webmentions/receive" rel="webmention">
|
||||||
<!-- webmanifest defines even more icons. This is getting ridiculous -->
|
<!-- webmanifest defines even more icons. This is getting ridiculous -->
|
||||||
{{- $webmanifest := resources.Get "/manifest.webmanifest" | resources.ExecuteAsTemplate "manifest.webmanifest" . | resources.Minify | resources.Fingerprint "md5" -}}
|
{{- $webmanifest := resources.Get "/manifest.webmanifest" | resources.ExecuteAsTemplate "manifest.webmanifest" . | resources.Minify | resources.Fingerprint "md5" -}}
|
||||||
{{- printf `<link rel="manifest" href="%s">` $webmanifest.RelPermalink | safeHTML }}
|
{{- printf `<link href="%s" rel="manifest">` $webmanifest.RelPermalink | safeHTML }}
|
||||||
<meta name="color-scheme" content="light dark">
|
{{- end }}
|
||||||
<meta name="theme-color" content="#0d0d0d" media="(prefers-color-scheme: dark)">
|
<link href="https://seirdy.one{{ .RelPermalink }}" rel="canonical">
|
||||||
<meta name="theme-color" content="#fff" media="(prefers-color-scheme: light)">
|
|
||||||
<link rel="alternate" type="application/rss+xml" href="{{ .Site.BaseURL }}posts/index.xml" title="{{ $.Site.Title }}">
|
<link rel="alternate" type="application/rss+xml" href="{{ .Site.BaseURL }}posts/index.xml" title="{{ $.Site.Title }}">
|
||||||
<!-- Don't index the tildeverse mirror, staging site, etc. -->
|
|
||||||
{{ if and (ne .Site.BaseURL "https://seirdy.one/") (ne .Site.BaseURL "http://wgq3bd2kqoybhstp77i3wrzbfnsyd27wt34psaja4grqiezqircorkyd.onion/") -}}
|
|
||||||
<meta name="robots" content="noindex">
|
|
||||||
{{ else -}}
|
|
||||||
<!-- IDC how much content is extracted from my pages, go knock yourself out. huge images, long snippets, whatever. -->
|
|
||||||
<meta name="robots" content="max-image-preview:large, max-snippet=-1">
|
|
||||||
<link rel="webmention" href="https://seirdy.one/webmentions/receive">
|
|
||||||
{{ end -}}
|
|
||||||
<link rel="canonical" href="https://seirdy.one{{ .RelPermalink }}">
|
|
||||||
<!-- inline CSS; remember to allow it with a hash in the CSP -->
|
<!-- inline CSS; remember to allow it with a hash in the CSP -->
|
||||||
{{ $resources := slice -}}
|
{{- $resources := slice -}}
|
||||||
{{ $resources = $resources | append (resources.Get "/css/main.css") -}}
|
{{- $resources = $resources | append (resources.Get "/css/main.css") -}}
|
||||||
{{ $dark := .Site.Params.dark | default "auto" -}}
|
{{ $dark := .Site.Params.dark | default "auto" -}}
|
||||||
{{ if not (eq $dark "off") -}}
|
{{- if not (eq $dark "off") -}}
|
||||||
{{ $resources = $resources | append (resources.Get "css/dark.css" | resources.ExecuteAsTemplate "dark.css" .) -}}
|
{{ $resources = $resources | append (resources.Get "css/dark.css" | resources.ExecuteAsTemplate "dark.css" .) -}}
|
||||||
{{ end -}}
|
{{- end -}}
|
||||||
{{ $css := $resources | resources.Concat "css/style.css" | minify -}}
|
{{- $css := $resources | resources.Concat "css/style.css" | minify -}}
|
||||||
<style>{{ $css.Content | safeCSS }}</style>
|
<style>{{ $css.Content | safeCSS }}</style>
|
||||||
{{- if eq .RelPermalink "/" }}
|
{{- if eq .RelPermalink "/" }}
|
||||||
<title>{{ .Title }}</title>
|
<title>{{ .Title }}</title>
|
||||||
|
@ -64,10 +65,5 @@
|
||||||
<meta property="profile:first_name" content="{{ .Site.Author.first }}">
|
<meta property="profile:first_name" content="{{ .Site.Author.first }}">
|
||||||
<meta property="profile:last_name" content="{{ .Site.Author.last }}">
|
<meta property="profile:last_name" content="{{ .Site.Author.last }}">
|
||||||
<meta property="profile:username" content="{{ .Site.Author.nick }}">
|
<meta property="profile:username" content="{{ .Site.Author.nick }}">
|
||||||
<meta property="article:author" content="{{ .Site.Author.name }}">
|
|
||||||
<meta property="article:published_time" content="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">
|
|
||||||
{{ if lt .Date .Lastmod -}}
|
|
||||||
<meta property="article:modified_time" content="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}">
|
|
||||||
{{ end -}}
|
|
||||||
{{ hugo.Generator }}
|
{{ hugo.Generator }}
|
||||||
</head>
|
</head>
|
||||||
|
|
Loading…
Reference in a new issue