We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a7e897b commit dd3030dCopy full SHA for dd3030d
layouts/sitemap.xml
@@ -196,9 +196,16 @@
196
{{- /* Add content pages */ -}}
197
{{- range where .Site.AllPages "Kind" "page" -}}
198
{{- if and (ne .Permalink "") (ne .Draft true) -}}
199
+ {{- $lastmodDate := $currentDate -}}
200
+ {{- if .Lastmod -}}
201
+ {{- $formatted := .Lastmod.Format "2006-01-02T15:04:05-07:00" -}}
202
+ {{- if not (hasPrefix $formatted "0001-01-01") -}}
203
+ {{- $lastmodDate = $formatted -}}
204
+ {{- end -}}
205
206
<url>
207
<loc>{{ .Permalink }}</loc>
- <lastmod>{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | default $currentDate }}</lastmod>
208
+ <lastmod>{{ $lastmodDate }}</lastmod>
209
<changefreq>monthly</changefreq>
210
<priority>0.6</priority>
211
</url>
0 commit comments