sitemap.xml 1.0 KB

123456789101112131415161718192021222324252627282930
  1. {{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
  2. <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
  3. xmlns:xhtml="http://www.w3.org/1999/xhtml">
  4. {{/* Check that page is built (has a URL) and is not private. */}}
  5. {{ range where (where .Data.Pages "Permalink" "!=" nil) "Params.private" "ne" true }}
  6. <url>
  7. <loc>{{ .Permalink }}</loc>
  8. {{- if not .Lastmod.IsZero }}<lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>{{ end }}
  9. {{- with .Sitemap.ChangeFreq }}<changefreq>{{ . }}</changefreq>{{ end }}
  10. {{- if ge .Sitemap.Priority 0.0 }}<priority>{{ .Sitemap.Priority }}</priority>{{ end }}
  11. {{- if .IsTranslated -}}
  12. {{- range .Translations -}}
  13. <xhtml:link
  14. rel="alternate"
  15. hreflang="{{ .Language.Lang }}"
  16. href="{{ .Permalink }}"
  17. />
  18. {{- end -}}
  19. <xhtml:link
  20. rel="alternate"
  21. hreflang="{{ .Language.Lang }}"
  22. href="{{ .Permalink }}"
  23. />
  24. {{- end -}}
  25. </url>
  26. {{- end -}}
  27. </urlset>