Make sitemap always use UTC time instead of the time retrieved from gitInfo

Is it possible to always use UTC time in the sitemap?

I created the following example:

This example includes layouts/_default/sitemap.xml, which replaces “-07:00” in the embedded layout with “+00:00”. But the generated sitemap contains


, while the real commit time of is 2024-05-14T21:02:53-07:00. GMT-07:00 is the timezone in the relevant git commit.

I understand that robot readers can probably perform timezone conversion by themselves, but I would prefer some privacy on the geolcation where the page was modified on some sites.

In the sitemap template do this…

.Lastmod.UTC.Format "2006-01-02T15:04:05-07:00"

…instead of this:

.Lastmod.Format "2006-01-02T15:04:05-07:00"


The bit inside of the quotes is a layout string; it affects how a time.Time value is rendered. The layout string is described here:

1 Like

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