Skip to content

Commit

Permalink
sitemap.xml: update from upstream
Browse files Browse the repository at this point in the history
Note that in order to exclude a page from sitemap you now need to use
the following in the front matter:

```
sitemap:
  exclude: true
```
  • Loading branch information
XhmikosR committed Mar 24, 2024
1 parent 4b02b12 commit 5dcf7e1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/layouts/sitemap.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
{{- range .Data.Pages -}}{{ if and .Permalink (ne .Params.sitemap_exclude true) }}
{{- range where .Data.Pages "Params.sitemap.exclude" "ne" true -}}{{ if .Permalink }}
<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 }}{{ if .IsTranslated }}{{ range .Translations }}
<xhtml:link rel="alternate" hreflang="{{ .Language.Lang }}" href="{{ .Permalink }}"/>{{ end }}
<xhtml:link rel="alternate" hreflang="{{ .Language.Lang }}" href="{{ .Permalink }}"/>{{ end }}
<xhtml:link rel="alternate" hreflang="{{ .Language.LanguageCode }}" href="{{ .Permalink }}"/>{{ end }}
<xhtml:link rel="alternate" hreflang="{{ .Language.LanguageCode }}" href="{{ .Permalink }}"/>{{ end }}
</url>{{ end }}{{ end }}
</urlset>

0 comments on commit 5dcf7e1

Please sign in to comment.