tplimpl: Output xmlns:xhtml only if there are translations available
authorJamie Connolly <jamie@jamieconnolly.com>
Tue, 3 Oct 2017 13:31:12 +0000 (14:31 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 3 Oct 2017 21:46:18 +0000 (23:46 +0200)
tpl/tplimpl/template_embedded.go

index dd3254560462f4e66c4cb377a111284b11ef88a8..dfabcbe11950524fd19fffabba87fa505a2c39ae 100644 (file)
@@ -87,8 +87,8 @@ func (t *templateHandler) embedTemplates() {
   </channel>
 </rss>`)
 
-       t.addInternalTemplate("_default", "sitemap.xml", `<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
-  xmlns:xhtml="http://www.w3.org/1999/xhtml">
+       t.addInternalTemplate("_default", "sitemap.xml", `<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"{{ if .IsTranslated }}
+  xmlns:xhtml="http://www.w3.org/1999/xhtml"{{ end }}>
   {{ range .Data.Pages }}
   <url>
     <loc>{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }}