Update sitemap-template.md

This commit is contained in:
Bjørn Erik Pedersen 2018-07-27 15:09:00 +02:00 committed by GitHub
parent f3417dd52f
commit 9b53380c44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,13 +46,24 @@ For multilingual sites, we also create a Sitemap index. You can provide a custom
This template respects the version 0.9 of the [Sitemap Protocol](http://www.sitemaps.org/protocol.html).
```xml
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{{ range .Pages }}
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
{{ range .Data.Pages }}
<url>
<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 }}
<priority>{{ .Sitemap.Priority }}</priority>{{ end }}{{ if .IsTranslated }}{{ range .Translations }}
<xhtml:link
rel="alternate"
hreflang="{{ .Lang }}"
href="{{ .Permalink }}"
/>{{ end }}
<xhtml:link
rel="alternate"
hreflang="{{ .Lang }}"
href="{{ .Permalink }}"
/>{{ end }}
</url>
{{ end }}
</urlset>