When I view my source code,
<meta name="article:published_time" content="{{ .Params.Date.Format "2006-01-02T09:04:05-07:00" }}">
is rendered as
<meta name="article:published_time" content="2022-11-23T09:00:00+03:00">
Is the -
sign being converted to +
expected by default? Or can it be prevented?
Go’s html/template package is escaping an attribute value, as designed.
Let’s tell the template that the attribute value is safe:
<meta name="article:published_time" {{ printf "content=%q" (.Date.Format "2006-01-02T09:04:05-07:00") | safeHTMLAttr }}>
1 Like
Thank you! That solves it.
system
Closed
4
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.