shithub: hugo

Download patch

ref: d0a4645a3412438d47ef98b7cf8f77f15a04eae7
parent: 3882e7ceaf818e295fdc652377af914bb60faf7f
author: Juan B. Rodriguez <jbrodriguez@gmail.com>
date: Thu May 14 12:58:14 EDT 2015

Set s.Info.LastChange to Lastmod

Set sitemap.xml <lastmod> field to Lastmod.

See #733

--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -697,7 +697,7 @@
 
 	s.assembleTaxonomies()
 	s.assembleSections()
-	s.Info.LastChange = s.Pages[0].Date
+	s.Info.LastChange = s.Pages[0].Lastmod
 
 	return
 }
--- a/tpl/template_embedded.go
+++ b/tpl/template_embedded.go
@@ -73,8 +73,8 @@
 	t.AddInternalTemplate("_default", "sitemap.xml", `<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
   {{ range .Data.Pages }}
   <url>
-    <loc>{{ .Permalink }}</loc>{{ if not .Date.IsZero }}
-    <lastmod>{{ safeHTML ( .Date.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>{{ end }}{{ with .Sitemap.ChangeFreq }}
+    <loc>{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }}
+    <lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>{{ end }}{{ with .Sitemap.ChangeFreq }}
     <changefreq>{{ . }}</changefreq>{{ end }}{{ if ge .Sitemap.Priority 0.0 }}
     <priority>{{ .Sitemap.Priority }}</priority>{{ end }}
   </url>
--