diff --git a/layouts/partials/favicon.html b/layouts/partials/favicon.html
index 6722748825..8aec49612d 100644
--- a/layouts/partials/favicon.html
+++ b/layouts/partials/favicon.html
@@ -1,14 +1,14 @@
     {{- $assetBusting := not .Site.Params.disableAssetsBusting }}
     {{- if (fileExists "/static/images/favicon.svg") }}
-    <link rel="icon" href="{{ "images/favicon.svg" | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" type="image/svg+xml">
+    <link href="{{ "images/favicon.svg" | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="icon" type="image/svg+xml">
     {{- else if (fileExists "/static/images/favicon.png") }}
-    <link rel="icon" href="{{ "images/favicon.png" | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" type="image/png">
+    <link href="{{ "images/favicon.png" | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="icon" type="image/png">
     {{- else if (fileExists "/static/images/favicon.ico") }}
-    <link rel="icon" href="{{ "images/favicon.ico" | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" type="image/x-icon">
+    <link href="{{ "images/favicon.ico" | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="icon" type="image/x-icon">
     {{- else if (fileExists "/static/images/logo.svg") }}
-    <link rel="icon" href="{{ "images/logo.svg" | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" type="image/svg+xml">
+    <link href="{{ "images/logo.svg" | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="icon" type="image/svg+xml">
     {{- else if (fileExists "/static/images/logo.png") }}
-    <link rel="icon" href="{{ "images/logo.png" | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" type="image/png">
+    <link href="{{ "images/logo.png" | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="icon" type="image/png">
     {{- else if (fileExists "/static/images/logo.ico") }}
-    <link rel="icon" href="{{ "images/logo.ico" | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" type="image/x-icon">
+    <link href="{{ "images/logo.ico" | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="icon" type="image/x-icon">
     {{- end }}
\ No newline at end of file
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index f29f55dc5b..a9f6a7afd8 100644
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -2,20 +2,21 @@
 <html lang="{{ .Page.Language | default "en" }}">
   <head>
     {{- partial "meta.html" . }}
+    {{- $link := "<link href=\"%s\" rel=\"%s\" type=\"%s\" title=\"%s\">" }}
     <title>{{ if and .Title (not (eq .Title .Site.Title)) }}{{ .Title }} {{ default "::" .Site.Params.titleSeparator }} {{ end}}{{ .Site.Title }}</title>
 
     {{- if not (and .Title (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSeoHiddenPages true) ) ) }}
     {{- else }}
         {{- range .AlternativeOutputFormats }}
             {{- if ne .Name "JSON" }}
-    <link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | relURL }}" title="{{ $.Site.Title | safeHTML }}" />
+    {{ (printf $link (.Permalink | relURL) .Rel .MediaType.Type ($.Site.Title | htmlEscape)) | safeHTML }}
             {{- end }}
         {{- end }}
     {{- end }}
     {{- if and (ne .Site.Params.disableSeoHiddenPages true) (ne .Site.Params.disableSearchHiddenPages true) }}
         {{- range .AlternativeOutputFormats }}
             {{- if eq .Name "JSON" }}
-    <link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | relURL }}" title="{{ $.Site.Title | safeHTML }}" />
+    {{ (printf $link (.Permalink | relURL) .Rel .MediaType.Type ($.Site.Title | htmlEscape)) | safeHTML }}
             {{- end }}
         {{- end }}
     {{- end }}
diff --git a/layouts/partials/meta.html b/layouts/partials/meta.html
index 1d1cd80904..4f580da0f3 100644
--- a/layouts/partials/meta.html
+++ b/layouts/partials/meta.html
@@ -2,10 +2,13 @@
     <meta charset="utf-8">
     {{- $c:=""}}{{/* to avoid that user swiping to the left leaves a gap on the right side, we set minimum-scale, even if not advised to */}}
     <meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0, minimum-scale=1.0">
-    {{ hugo.Generator }}
+    {{- $gen := hugo.Generator }}
+    {{- $gen = replaceRE "\\s*/>$" ">" $gen }}
+    {{ $gen | safeHTML }}
     {{- $ver := partial "version.html" }}
     {{- $ver = replaceRE "\\s*(\\S*)" "${1}" $ver }}
-    <meta name="generator" content="Relearn {{ $ver }}">
+    {{- $ver := printf "<meta name=\"generator\" content=\"%s %s\">" "Relearn" $ver }}
+    {{ $ver | safeHTML }}
     {{- partial "page-meta.hugo" . }}
     {{- if not (and .Title (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSeoHiddenPages true) ) ) }}
     <meta name="robots" content="noindex, nofollow, noarchive, noimageindex">