Skip to content

Commit dd3030d

Browse files
committed
Sitemap issue FIxed
1 parent a7e897b commit dd3030d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

layouts/sitemap.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,16 @@
196196
{{- /* Add content pages */ -}}
197197
{{- range where .Site.AllPages "Kind" "page" -}}
198198
{{- 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+
{{- end -}}
199206
<url>
200207
<loc>{{ .Permalink }}</loc>
201-
<lastmod>{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | default $currentDate }}</lastmod>
208+
<lastmod>{{ $lastmodDate }}</lastmod>
202209
<changefreq>monthly</changefreq>
203210
<priority>0.6</priority>
204211
</url>

0 commit comments

Comments
 (0)