fix: inclusion of null locs in sitemap.xml

Impacted by Hugo changes

Fix #2732
This commit is contained in:
Geo 2022-06-02 22:56:51 +01:00
commit d26624902d

View file

@ -2,7 +2,7 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
{{/* Check that page is built (has a URL) and is not private. */}}
{{ range where (where .Data.Pages "Permalink" "!=" nil) "Params.private" "ne" true }}
{{ range where (where .Data.Pages "Permalink" "!=" "") "Params.private" "ne" true }}
<url>
<loc>{{ .Permalink }}</loc>
{{- if not .Lastmod.IsZero }}<lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>{{ end }}