Use safeHTMLAttr to avoid encoding charecters in header meta and link tags.

This commit is contained in:
Fredrik Jonsson 2019-12-10 15:19:56 +01:00
commit 8ad67c1716
2 changed files with 5 additions and 5 deletions

View file

@ -1,9 +1,9 @@
{{ range .AlternativeOutputFormats -}}
<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" title="{{ .Name }}" href="{{ .Permalink | safeURL }}">
<link rel="{{ .Rel }}" {{ printf "type=%q" .MediaType.Type | safeHTMLAttr }} title="{{ .Name }}" href="{{ .Permalink | safeURL }}">
{{ end -}}
<meta name="description" content="{{ with (.Description | default (replaceRE "\n" " " (.Summary | truncate 170))) }}{{ . }}{{ end }}">
<meta name="created" content="{{ .Date.Format "2006-01-02T15:04:05-0700" }}">
<meta name="modified" content="{{ .Lastmod.Format "2006-01-02T15:04:05-0700" }}">
<meta name="created" {{printf "content=%q" (.Date.Format "2006-01-02T15:04:05-0700") | safeHTMLAttr }}>
<meta name="modified" {{printf "content=%q" (.Lastmod.Format "2006-01-02T15:04:05-0700") | safeHTMLAttr }}>
{{ with $.Param "author" }}<meta name="author" content="{{ . }}">{{ end }}
{{ with $.Param "contact" }}<meta name="contact" content="{{ . }}">{{ end }}
<meta property="og:site_name" content="{{ .Site.Title }}">

View file

@ -1,4 +1,4 @@
<p class="submitted">
<div class="submitted">
{{ with $.Param "author" }}<span class="author" itemprop="author">{{ . }}</span> – {{ end -}}
<time class="modified-date" datetime="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Lastmod.Format ($.Param "dateformat" | default "2 January, 2006") }}</time>
</p>
</div>