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

Remove optional HTML tags

Some HTML tags can be removed without changing the DOM. Reference:
https://html.spec.whatwg.org/multipage/syntax.html#syntax-tag-omission
This commit is contained in:
Rohan Kumar 2021-05-06 11:59:30 -07:00
parent 558b6844ca
commit 43a3e7c0f8
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479
2 changed files with 69 additions and 74 deletions

View file

@ -1,11 +1,8 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="{{- default "" .Site.LanguageCode -}}"> <html lang="{{- default "" .Site.LanguageCode -}}">
{{- partial "head.html" . -}} {{- partial "head.html" . -}}
<body> {{- partial "header.html" . -}}
{{- partial "header.html" . -}} <main id="content">
<main id="content"> {{- block "main" . }}{{- end }}
{{- block "main" . }}{{- end }} </main>
</main> {{- partial "footer.html" . -}}
{{- partial "footer.html" . -}}
</body>
</html>

View file

@ -1,66 +1,64 @@
<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"> <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 name="author" content="{{ .Site.Author.name }}"> {{- $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" | resources.Fingerprint "md5" -}}
{{ $favicon := resources.Get "/favicon.png" | resources.Fingerprint "md5" -}} {{ printf `<link rel="icon" sizes="32x32" href="%s" type="image/png">` $favicon.RelPermalink | safeHTML -}}
{{ printf `<link rel="icon" sizes="32x32" href="%s" type="image/png">` $favicon.RelPermalink | safeHTML -}} <!-- apple-touch-icon used to be apple-specific, but now it's
<!-- apple-touch-icon used to be apple-specific, but now it's a pseudo-standard relied upon by other vendors too:
a pseudo-standard relied upon by other vendors too: https://html.spec.whatwg.org/multipage/semantics.html#attr-link-sizes -->
https://html.spec.whatwg.org/multipage/semantics.html#attr-link-sizes --> {{ printf `<link rel="apple-touch-icon" href="%s">` $icon_192.RelPermalink | safeHTML -}}
{{ printf `<link rel="apple-touch-icon" href="%s">` $icon_192.RelPermalink | safeHTML -}} <!-- 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 rel="manifest" href="%s">` $webmanifest.RelPermalink | safeHTML }} <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 }}"> {{ if ne .Site.BaseURL "https://seirdy.one/" -}}
{{ if ne .Site.BaseURL "https://seirdy.one/" -}} <meta name="robots" content="noindex">
<meta name="robots" content="noindex"> {{ else -}}
{{ else -}} <link rel="webmention" href="https://seirdy.one/webmentions/receive">
<link rel="webmention" href="https://seirdy.one/webmentions/receive"> <link rel="canonical" href="https://seirdy.one{{ .RelPermalink }}">
<link rel="canonical" href="https://seirdy.one{{ .RelPermalink }}"> {{ end -}}
{{ end -}} <link rel="pgpkey" type="application/pgp-keys" href="{{ .Site.BaseURL }}publickey.asc">
<link rel="pgpkey" type="application/pgp-keys" href="{{ .Site.BaseURL }}publickey.asc"> {{- $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 | resources.Fingerprint "sha384" -}}
{{ $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 -}}
{{ printf `<link rel="stylesheet" href="%s" integrity="%s">` $css.RelPermalink $css.Data.Integrity | safeHTML -}} <!-- only load syntax-highlighting CSS if this page needs it -->
<!-- only load syntax-highlighting CSS if this page needs it --> {{ if .Params.highlight -}}
{{ if .Params.highlight -}} {{ $css_syntax := resources.Get "/css/syntax.css" | minify | resources.Fingerprint "sha384" -}}
{{ $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 }}
{{- printf `<link rel="stylesheet" href="%s" integrity="%s">` $css_syntax.RelPermalink $css_syntax.Data.Integrity | safeHTML }} {{- end -}}
{{- end -}} {{- if eq .RelPermalink "/" -}}
{{- if eq .RelPermalink "/" -}} <title>{{ .Title }}</title>
<title>{{ .Title }}</title> {{- else -}}
{{- else -}} <title>{{ .Title }} - Seirdy</title>
<title>{{ .Title }} - Seirdy</title> {{- end -}}
{{- end -}} <!-- open graph stuff; used in the Fediverse, Signal link previews,
<!-- open graph stuff; used in the Fediverse, Signal link previews, some RSS readers, and a certain large social media company -->
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) }} <meta property="og:type" content="article">
<meta property="og:type" content="article"> {{- else }}
{{- else }} <meta property="og:type" content="website">
<meta property="og:type" content="website"> {{- end -}}
{{- end -}} <!-- ANOTHER meta image?! When will it end? -->
<!-- ANOTHER meta image?! When will it end? --> {{ $og_image := resources.Get "/open_graph.png" | resources.Fingerprint "md5" -}}
{{ $og_image := resources.Get "/open_graph.png" | resources.Fingerprint "md5" -}} {{ printf `<meta property="og:image" content="%s">` $og_image.Permalink | safeHTML }}
{{ printf `<meta property="og:image" content="%s">` $og_image.Permalink | safeHTML }} <meta property="og:image:type" content="image/png">
<meta property="og:image:type" content="image/png"> <meta property="og:image:height" content="630">
<meta property="og:image:height" content="630"> <meta property="og:image:width" content="1200">
<meta property="og:image:width" content="1200"> <meta property="og:url" content="https://seirdy.one{{ .RelPermalink }}">
<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="og:description" content="{{ if .Params.description }}{{ .Params.description }}{{ else }}{{ .Site.Params.Description }}{{ end }}"> <meta property="article:author" content="{{ .Site.Author.name }}">
<meta property="article:author" content="{{ .Site.Author.name }}"> <meta property="article:published_time" content="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">
<meta property="article:published_time" content="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}"> {{ 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 -}} {{ hugo.Generator }}
{{ hugo.Generator }}
</head>