The timezone offset is optional. You can do it like this: date = 2022-05-27T18:35:34
or 2022-05-27T18:35
. Hugo will simply assume “local” time (as set in the OS Hugo was executed) or based on the timezone config found in the config
file (if you added one, for example mine is timeZone = "Etc/UTC"
so content without a timezone offset in date
will assume UTC).
Yep, that is correct.
Hugo should display it as 18:35+01:00
.
And this is the weird part, it should not do that. Hugo should be rendering it as 18:35+01:00
since that is what’s in the date
frontmatter. If it shows 17:35
or 19:35
there is something else interfering.
I pulled your test repo again and set my system’s timezone to Italy.
Current time for this test is 2022-05-28 03:20 +02:00.
hugo new
generated
date: 2022-05-28T03:20:00+02:00
Since the theme doesn’t display the time in the frontend, I checked the source instead
<meta property="article:published_time" content="2022-05-28T03:20:00+02:00" />
<meta property="article:modified_time" content="2022-05-28T03:20:00+02:00" />
I then changed the post date to: date: 2022-05-28T03:20:00+01:00
I then reloaded Hugo for good measure, the time in source is:
<meta property="article:published_time" content="2022-05-28T03:20:00+01:00" />
<meta property="article:modified_time" content="2022-05-28T03:20:00+01:00" />
I changed the timezone offset to +3: date: 2022-05-28T03:20:00+03:00
The content’s time is:
<meta property="article:published_time" content="2022-05-28T03:20:00+03:00" />
<meta property="article:modified_time" content="2022-05-28T03:20:00+03:00" />
I can not duplicate what you’ve been experiencing. This is why I think there is something else causing it.
For the time to change, it has to be manually changed in the date
frontmatter. For example,
date: 2022-05-28T03:20:00+02:00
If you want to display non-DST, change the date
time and timezone:
date: 2022-05-28T02:20:00+01:00
In any case, since the theme is not displaying the content’s date, you can look into this some other time in the future (pun intended). Search engines care more about the date than the time of content. 
As for this:
I’m not seeing it in the test repo you provided. The source is fine:
<meta property="article:published_time" content="2022-05-28T03:20:00+02:00" />
That code comes from {{ template "_internal/opengraph.html" . }}
and in your test repo, you’re using the default that comes with Hugo (see: https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/opengraph.html ) so it should not be displaying a different time format.
This is the part related to that:
{{- if .IsPage }}
{{- $iso8601 := "2006-01-02T15:04:05-07:00" -}}
<meta property="article:section" content="{{ .Section }}" />
{{ with .PublishDate }}<meta property="article:published_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end }}
{{ with .Lastmod }}<meta property="article:modified_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end }}
{{- end -}}
The default _internal/opengraph.html
is set to this format {{- $iso8601 := "2006-01-02T15:04:05-07:00" -}}
.
I also checked your theme, since some themes include their own opengraph tags, but your theme doesn’t have any custom OG.
I’m thinking the test repo is no longer the same as your main project repo. I tried to search for <meta property="article:modified_time" content="{{ .Page.Lastmod }}" />
but did not find it.
Take a break, enjoy the weekend!
