1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-11-24 05:02:10 +00:00
seirdy.one/layouts/partials/head.html
Rohan Kumar 10cb71855f
Reorg <head> links
- Put canonical near the top
- Allow non-canonical versions to be indexed, since they do have
  canonical links
2022-03-04 13:55:39 -08:00

62 lines
4.1 KiB
HTML

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://seirdy.one{{ .RelPermalink }}" rel="canonical">
<link href="https://seirdy.one/webmentions/receive" rel="webmention">
{{- if and (eq .Site.BaseURL "https://seirdy.one/") (eq .Site.BaseURL "http://wgq3bd2kqoybhstp77i3wrzbfnsyd27wt34psaja4grqiezqircorkyd.onion/") -}}
<!-- 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">
{{- end }}
<meta name="description" content="{{ if .Params.description }}{{ .Params.description }}{{ else }}{{ .Site.Params.Description }}{{ end }}">
<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_svg := resources.Get "/favicon.svg" | resources.Fingerprint "md5" }}
{{- printf `<link rel="icon" sizes="any" href="%s" type="image/svg+xml">` $icon_svg.RelPermalink | safeHTML }}
{{ $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 -}}
{{ $favicon := resources.Get "/favicon.png" -}}
{{ $favicon_base64 := $favicon.Content | base64Encode }}
{{ printf `<link rel="icon" sizes="32x32" href="data:image/png;base64,%s" type="image/png">` $favicon_base64 | safeHTML -}}
<!-- Why does apple do this -->
<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)">
<!-- webmanifest defines even more icons. This is getting ridiculous -->
{{- $webmanifest := resources.Get "/manifest.webmanifest" | resources.ExecuteAsTemplate "manifest.webmanifest" . | resources.Minify | resources.Fingerprint "md5" -}}
{{- printf `<link href="%s" rel="manifest">` $webmanifest.RelPermalink | safeHTML }}
<link rel="alternate" type="application/rss+xml" href="{{ .Site.BaseURL }}posts/index.xml" title="{{ $.Site.Title }}">
<!-- inline CSS; remember to allow it with a hash in the CSP -->
{{- $resources := slice -}}
{{- $resources = $resources | append (resources.Get "/css/main.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 -}}
<style>{{ $css.Content | safeCSS }}</style>
<title>{{ .Title }}{{ if and (lt (len .Title) 66) (ne .RelPermalink "/") }} - Seirdy{{ end }}</title>
<meta property="og:title" content="{{ .Title }}">
<meta property="og:site_name" content="{{ $.Site.Title }}">
{{- if (eq "page" .Kind) }}
<meta property="og:type" content="article">
{{- else }}
<meta property="og:type" content="website">
{{- end -}}
<!-- ANOTHER meta image?! When will it end? -->
{{ $og_image := resources.Get "/favicon512.png" | resources.Fingerprint "md5" -}}
{{ printf `<meta property="og:image" content="%s">` $og_image.Permalink | safeHTML }}
<meta property="og:image:type" content="image/png">
<meta property="og:image:height" content="512"><meta property="og:image:width" content="512">
<meta property="og:image:alt" content="White-on-black colon and semicolon">
<meta property="og:url" content="https://seirdy.one{{ .RelPermalink }}">
<meta property="og:description" content="{{ if .Params.description }}{{ .Params.description }}{{ else }}{{ .Site.Params.Description }}{{ end }}">
<meta property="profile:first_name" content="{{ .Site.Author.first }}">
<meta property="profile:last_name" content="{{ .Site.Author.last }}">
<meta property="profile:username" content="{{ .Site.Author.nick }}">
{{ hugo.Generator }}
</head>