Invalid lastmod date in sitemap.xml

In my sitemap.xml are many (not all) webpages with invalid lastmod-dates:


What is the reason of this and how can I solve it?

This is usually a sign that the date in your content’s front-matter is not in a proper format.

E.g. If you use date: 2015-09-09T15:06:24+01:00 or date: 2015-09-09, your templates will render the date correctly. However if you use date: 2015-09-, they will fail and result in the date-timestamp you have above.

1 Like

Hi there,

I have the following in my sitemap.xml template that seems to follow the format you specify:

<urlset xmlns="">
  {{ range .Data.Pages }}
    <loc>{{ .Site.BaseURL }}</loc>
    <lastmod>{{ safeHTML ( .Date.Format "2015-09-09T15:06:24+01:00" ) }}</lastmod>{{ with .Sitemap.ChangeFreq }}
    <changefreq>{{ . }}</changefreq>{{ end }}{{ if ge .Sitemap.Priority 0.0 }}
    <priority>{{ .Sitemap.Priority }}</priority>{{ end }}
  {{ end }}

However when rendered it’s incorrect:

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<urlset xmlns="">



Any ideas why this might be the case?

Check your date(s) in the page front matter.


how about trying the code below?

<lastmod>{{ safeHTML ( .Now.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>

I have this problem in the entry of categories and tags.


How to change the date of these automatically rendered pages?

I disabled taxonomies at all with:

disableKinds = ["taxonomy","taxonomyTerm"]

and the entry went away.