How to convert UTC+07:00

I want to add date meta on head. How to convert UT+C7:00 without parsing. In my front matter like this.
date: 2021-06-18T07:20:00+07:00

I did convert to meta tag like this
<meta content="{{ .PublishDate.Format "2006-01-02T15:04:05+07:00" | safeHTML }}" itemprop="datePublished" />

After doing the conversion, the + character gets parsed instead. So the output is like this.
<meta content="2021-06-18T07:20:00&#43;07:00" itemprop="datePublished" />

Because what I want is like this. The question is how?
<meta content="2021-06-18T07:20:00+07:00" itemprop="datePublished" />

Are you using the safeHTML function?

Sorry, I forgot to add safeHTML and have edited my post. The result is still the same even though I use safeHTML.

<meta itemprop="datePublished" {{ .PublishDate.Format "2006-01-02T15:04:05-07:00" | printf "content=%q" | safeHTMLAttr }}>
1 Like

Thank you, its works :grin:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.