Please add limit the sitemap size

Pain in the $$$ ? :wink:
break it down by sections

my templates from layouts/_default

home.sitemap.html

{{ print "<?xml version=\"1.0\" encoding=\"utf-8\" ?>"  | safeHTML }}
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">{{ range (where site.Sections "Section" "not in" site.Params.invisibleSections) }}
 <sitemap>
  <loc>{{ .Permalink }}sitemap.xml</loc>
 </sitemap>{{end}}
</sitemapindex>

section.sitemap.html

{{ print "<?xml version=\"1.0\" encoding=\"utf-8\" ?>"  | safeHTML }}
<urlset xmlns="http://wwwsitemaps.org/schemassitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">{{ range first site.Params.sitemapMax .CurrentSection.RegularPages }}
  <url>
    <loc>{{ .Permalink }}</loc>
    <lastmod>{{ safeHTML ( .Lastmod.Format site.Params.dateFormatFeed ) }}</lastmod>
  </url>{{ end }}
</urlset>

in the config

[Params]
    invisibleSections   = ["menu","intern","test","about"]
    sitemapMax          = 49999

[outputs]
    home                  = [ "HTML", "SITEMAP"]
    section               = [ "HTML", "SITEMAP" ]

[outputFormats.SITEMAP]
    MediaType             = "application/xml"
    BaseName              = "sitemap"
    suffix                = "xml"
    IsHTML                = false
    IsPlainText           = false
    noUgly                = true
    Rel                   = "alternate"

corrected spelling error

3 Likes