▾ added blog/layouts/sitemap.xml +31 -0 Viewed
new file mode 100644 @@ -0,0 +1,31 @@ 1 + {{- /* 2 + Hugo's stock sitemap, with one change: the xhtml:link hreflang is the bare 3 + language code (en, fr, pt), the same value baseof.html's <link rel= "alternate" > 4 + tags use, instead of the locale (en-us, fr-fr, pt-br). Two spellings of the 5 + same alternate is what a search engine reads as two different signals. 6 + */ -}} 7 + {{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?> " | safeHTML }} 8 + <urlset xmlns= "http://www.sitemaps.org/schemas/sitemap/0.9" 9 + xmlns:xhtml= "http://www.w3.org/1999/xhtml" > 10 + {{- range .Pages }} 11 + {{- if .Permalink }} 12 + <url > 13 + <loc > {{ .Permalink }}</loc> 14 + {{- if not .Lastmod.IsZero }} 15 + <lastmod > {{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</lastmod> 16 + {{- end }} 17 + {{- with .Sitemap.ChangeFreq }} 18 + <changefreq > {{ . }}</changefreq> 19 + {{- end }} 20 + {{- if ge .Sitemap.Priority 0.0 }} 21 + <priority > {{ .Sitemap.Priority }}</priority> 22 + {{- end }} 23 + {{- if .IsTranslated }} 24 + {{- range .AllTranslations }} 25 + <xhtml:link rel= "alternate" hreflang= "{{ .Language.Lang }}" href= "{{ .Permalink }}" /> 26 + {{- end }} 27 + {{- end }} 28 + </url> 29 + {{- end }} 30 + {{- end }} 31 + </urlset>
new file mode 100644 @@ -0,0 +1,31 @@ 1 + {{- /* 2 + Hugo's stock sitemap, with one change: the xhtml:link hreflang is the bare 3 + language code (en, fr, pt), the same value baseof.html's <link rel= "alternate" > 4 + tags use, instead of the locale (en-us, fr-fr, pt-br). Two spellings of the 5 + same alternate is what a search engine reads as two different signals. 6 + */ -}} 7 + {{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?> " | safeHTML }} 8 + <urlset xmlns= "http://www.sitemaps.org/schemas/sitemap/0.9" 9 + xmlns:xhtml= "http://www.w3.org/1999/xhtml" > 10 + {{- range .Pages }} 11 + {{- if .Permalink }} 12 + <url > 13 + <loc > {{ .Permalink }}</loc> 14 + {{- if not .Lastmod.IsZero }} 15 + <lastmod > {{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</lastmod> 16 + {{- end }} 17 + {{- with .Sitemap.ChangeFreq }} 18 + <changefreq > {{ . }}</changefreq> 19 + {{- end }} 20 + {{- if ge .Sitemap.Priority 0.0 }} 21 + <priority > {{ .Sitemap.Priority }}</priority> 22 + {{- end }} 23 + {{- if .IsTranslated }} 24 + {{- range .AllTranslations }} 25 + <xhtml:link rel= "alternate" hreflang= "{{ .Language.Lang }}" href= "{{ .Permalink }}" /> 26 + {{- end }} 27 + {{- end }} 28 + </url> 29 + {{- end }} 30 + {{- end }} 31 + </urlset>