1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-11-23 21:02:09 +00:00

Reorg <head> links

- Put canonical near the top
- Allow non-canonical versions to be indexed, since they do have
  canonical links
This commit is contained in:
Rohan Kumar 2022-03-04 13:55:39 -08:00
parent 86b4012ec0
commit 10cb71855f
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479

View file

@ -1,6 +1,12 @@
<head> <head>
<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">
<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 name="description" content="{{ if .Params.description }}{{ .Params.description }}{{ else }}{{ .Site.Params.Description }}{{ end }}">
<meta content="{{ .Site.Author.name }}" name="author"> <meta content="{{ .Site.Author.name }}" name="author">
<meta property="article:author" content="{{ .Site.Author.name }}"> <meta property="article:author" content="{{ .Site.Author.name }}">
@ -8,6 +14,8 @@
{{ if lt .Date .Lastmod -}} {{ if lt .Date .Lastmod -}}
<meta property="article:modified_time" content="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}"> <meta property="article:modified_time" content="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}">
{{ end -}} {{ 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" }} {{ $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" -}}
@ -18,18 +26,9 @@
<meta name="color-scheme" content="light dark"> <meta name="color-scheme" content="light dark">
<meta name="theme-color" content="#0d0d0d" media="(prefers-color-scheme:dark)"> <meta name="theme-color" content="#0d0d0d" media="(prefers-color-scheme:dark)">
<meta name="theme-color" content="#fff" media="(prefers-color-scheme:light)"> <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 href="%s" rel="manifest">` $webmanifest.RelPermalink | safeHTML }} {{- printf `<link href="%s" rel="manifest">` $webmanifest.RelPermalink | safeHTML }}
{{- end }}
<link href="https://seirdy.one{{ .RelPermalink }}" rel="canonical">
<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 }}">
<!-- 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 -}}
@ -40,13 +39,7 @@
{{- 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 "/" }} <title>{{ .Title }}{{ if and (lt (len .Title) 66) (ne .RelPermalink "/") }} - Seirdy{{ end }}</title>
<title>{{ .Title }}</title>
{{- else }}
<title>{{ .Title }}{{if lt (len .Title) 66 }} - Seirdy{{ end }}</title>
{{- end -}}
<!-- open graph stuff; used in the Fediverse, Signal link previews,
some RSS readers, and a certain large social media company -->
<meta property="og:title" content="{{ .Title }}"> <meta property="og:title" content="{{ .Title }}">
<meta property="og:site_name" content="{{ $.Site.Title }}"> <meta property="og:site_name" content="{{ $.Site.Title }}">
{{- if (eq "page" .Kind) }} {{- if (eq "page" .Kind) }}