cleaning falsely rendered pages (#2376)

This commit is contained in:
trean
2026-05-27 17:27:41 +02:00
committed by GitHub
parent 3c1c896294
commit 72aa0652a6
10 changed files with 34 additions and 3 deletions
@@ -2,8 +2,21 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
{{ range .Data.Pages }}
{{- if and (or (eq (isset .Params "sitemapexclude") false) (ne .Params.sitemapExclude true)) (ne .Permalink "") }}
{{- $includeInSitemap := true -}}
{{- if eq .Params.sitemapExclude true -}}
{{- $includeInSitemap = false -}}
{{- else if .Sitemap.Disable -}}
{{- $includeInSitemap = false -}}
{{- else -}}
{{- $render := "always" -}}
{{- with .Params.build -}}
{{- $render = .render | default "always" -}}
{{- end -}}
{{- if in (slice "never" "link") $render -}}
{{- $includeInSitemap = false -}}
{{- end -}}
{{- end -}}
{{- if and $includeInSitemap (ne .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 }}