Skip to content

pbSitemapIndex

Generates a sitemap index. If your site has many pages (e.g. news, products, articles), it's better to split the sitemap into parts.

1. In the main resource, use:

php
{'!pbSitemapIndex'|snippet}

2. Create child resources that will serve as separate sitemaps, e.g. for news:

php
{'!pbSitemap'|snippet: [
    'parent' => 7
]}

This creates separate sitemaps for each group, and pbSitemapIndex will collect links to them in the main sitemap index.

Example output of pbSitemapIndex:

xml
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <sitemap>
    <loc>https://site.com/sitemap-pages.xml</loc>
  </sitemap>
  <sitemap>
    <loc>https://site.com/sitemap-news.xml</loc>
  </sitemap>
</sitemapindex>

© PageBlocks 2019-present