From a74ec4d6f8b665a9e9ac61572e62ac23c111fc0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Thu, 7 Jul 2022 21:42:45 +0200 Subject: [PATCH] theme: nicer escaping in --- layouts/partials/favicon.html | 12 ++++++------ layouts/partials/header.html | 5 +++-- layouts/partials/meta.html | 7 +++++-- 3 files changed, 14 insertions(+), 10 deletions(-) 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") }} - + {{- else if (fileExists "/static/images/favicon.png") }} - + {{- else if (fileExists "/static/images/favicon.ico") }} - + {{- else if (fileExists "/static/images/logo.svg") }} - + {{- else if (fileExists "/static/images/logo.png") }} - + {{- else if (fileExists "/static/images/logo.ico") }} - + {{- 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 @@ {{- partial "meta.html" . }} + {{- $link := "" }} {{ if and .Title (not (eq .Title .Site.Title)) }}{{ .Title }} {{ default "::" .Site.Params.titleSeparator }} {{ end}}{{ .Site.Title }} {{- if not (and .Title (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSeoHiddenPages true) ) ) }} {{- else }} {{- range .AlternativeOutputFormats }} {{- if ne .Name "JSON" }} - + {{ (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" }} - + {{ (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 @@ {{- $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 */}} - {{ hugo.Generator }} + {{- $gen := hugo.Generator }} + {{- $gen = replaceRE "\\s*/>$" ">" $gen }} + {{ $gen | safeHTML }} {{- $ver := partial "version.html" }} {{- $ver = replaceRE "\\s*(\\S*)" "${1}" $ver }} - + {{- $ver := printf "" "Relearn" $ver }} + {{ $ver | safeHTML }} {{- partial "page-meta.hugo" . }} {{- if not (and .Title (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSeoHiddenPages true) ) ) }}