PolyCMS Plugin: XML Sitemap
The bundled XML Sitemap plugin in PolyCMS v1.4.0 automatically generates dynamic, search-engine-compliant XML sitemaps for published blog posts, pages, taxonomies, and active PolyStore product catalogs (including optional Dynamic Variant URLs), backed by v1.4.0 developer extension hooks and automatic MTOptimize v1.4.0 No Index exclusion.
Overview
Search engines including Google, Bing, and Yandex rely on XML sitemaps to discover new URLs, track content freshness via <lastmod> timestamps, and index large websites efficiently. PolyCMS builds sitemaps dynamically on request so your index always matches your live database state with zero manual regeneration.
Activation
- Navigate to Blog > Plugins.
- Find XML Sitemap and click Activate.
Multi-Sitemap Architecture
For clean index segmentation and scalable crawling, PolyCMS generates a master sitemap index referencing dedicated sub-sitemaps for each content type:
| Sitemap | URL Endpoint | Contents |
|---|---|---|
| Master Sitemap Index | /sitemap_index.xml or /{prefix}/sitemap.xml | Master XML index referencing all active core and plugin sub-sitemaps |
| Posts Sitemap | /{prefix}/sitemap-posts.xml | All published blog posts with lastmod and changefreq metadata |
| Pages Sitemap | /{prefix}/sitemap-pages.xml | All published static CMS pages |
| Categories Sitemap | /{prefix}/sitemap-categories.xml | All public category archive endpoints |
| Tags Sitemap | /{prefix}/sitemap-tags.xml | All active tag archive endpoints |
| Products & Variants Sitemap (PolyStore) | /product-sitemap.xml | Published public products (auto-chunked every 1,000 items with Google <image:image> tags, excluding No Index items) plus optional active Dynamic Variant URLs when enabled |
| Product Categories Sitemap (PolyStore) | /product-category-sitemap.xml | All visible, indexable storefront product category archives when PolyStore is active |
All blog endpoints automatically respect your configured blog prefix (such as /blog, /news, or root mode).
PolyStore Product, Image & Dynamic Variant Sitemaps
When PolyStore is active with sitemaps enabled in Store > Settings, both /product-sitemap.xml and /product-category-sitemap.xml automatically register inside /sitemap_index.xml as well as the XML Sitemap plugin's index and flat feeds:
- Chunked 1,000-Product Pagination: Large storefronts automatically split product feeds into chunks of 1,000 products per XML file (
/product-sitemap.xml,/product-sitemap-2.xml, and so on) to keep memory usage and response times fast. - Google Image Extensions: Product entries include
<image:image>tags referencing featured and gallery product images for Google Images discovery. - Optional Active Dynamic Variant URLs: When Dynamic SEO Variant URLs (
Polystore_Variant_Urls) are enabled in PolyStore (for example, alongsideselfcanonical mode for distinct color, finish, or storage configurations), administrators can optionally include active variant URLs directly inside the chunked/product-sitemap.xmlfeed alongside base product entries.
Automatic No Index Sitemap Exclusion (polycms_seo_excluded_object_ids)
Submitting a URL in your XML sitemap while simultaneously serving a noindex meta robots tag creates conflicting crawl signals in Google Search Console. With MTOptimize v1.4.0 and PolyStore's decoupled SEO architecture, XML sitemaps stay 100% synchronized with per-entity robots directives without any hard coupling between plugins:
- Decoupled Filter Query: Whenever PolyStore builds a sitemap feed, it runs
polycms_apply_filters('polycms_seo_excluded_object_ids', [], $object_type)forpolystore_productandpolystore_category. When MTOptimize v1.4.0 is active, it returns all entity IDs flaggednoindex = 1intblpolycms_seo_meta; when inactive, the filter safely returns an empty array. - Product Sitemap & Variant Feeds (
/product-sitemap.xml): Any product marked No Index in MTOptimize's Advanced tab is omitted from/product-sitemap.xmland every chunked/product-sitemap-{page}.xmlfile, together with its associated Dynamic Variant URLs. - Product Category Sitemap (
/product-category-sitemap.xml): Any storefront category marked No Index is automatically stripped from/product-category-sitemap.xml. - Master Sitemap Index Chunk Calculation (
/sitemap_index.xml): Excluded products are subtracted before computing the 1,000-item chunk count so/sitemap_index.xmlnever advertises empty trailing product sitemap chunks. - Flat-Mode XML Sitemap Hook (
polycms_xml_sitemap_extra_urls): When the XML Sitemap plugin operates in single-file flat mode, PolyStore applies the exact same exclusion list before appending product and category URLs.
Developer Extension Hooks (v1.4.0)
PolyCMS v1.4.0 provides dedicated filter hooks so third-party plugins (using PolyStore and MTOptimize v1.4.0 as reference implementations) can register custom sub-sitemaps, append flat URLs, and honor SEO noindex exclusions cleanly without editing core routing files:
| Filter Hook | Applied To | Input Value |
|---|---|---|
polycms_sitemap_index_entries | Sub-sitemap entries listed in the master /sitemap_index.xml | $entries (array of sub-sitemap definitions) |
polycms_xml_sitemap_sub_sitemaps | Sub-sitemap entries registered in XML Sitemap index mode | $entries (array of sub-sitemap URLs and lastmod dates) |
polycms_xml_sitemap_extra_urls | Additional URL entries appended when XML Sitemap runs in flat single-file mode | $urls (array of URL items with loc, lastmod, priority) |
polycms_seo_excluded_object_ids | Entity IDs flagged noindex = 1 to omit from sitemap queries and chunk counts | $ids (array), $object_type (string) |
Code Example: Registering a Custom Sub-Sitemap
// 1. Register a custom sub-sitemap inside /sitemap_index.xml and index mode
polycms_add_filter('polycms_sitemap_index_entries', function ($entries) {
$entries[] = [
'loc' => site_url('knowledgebase-sitemap.xml'),
'lastmod' => date('c'),
];
return $entries;
});
polycms_add_filter('polycms_xml_sitemap_sub_sitemaps', function ($entries) {
$entries[] = [
'loc' => site_url('knowledgebase-sitemap.xml'),
'lastmod' => date('c'),
];
return $entries;
});
// 2. Append extra URLs when XML Sitemap operates in flat mode
polycms_add_filter('polycms_xml_sitemap_extra_urls', function ($urls) {
$urls[] = [
'loc' => site_url('custom-landing-offer'),
'lastmod' => date('c'),
'changefreq' => 'weekly',
'priority' => '0.8',
];
return $urls;
});
Automatic Search Engine Pinging
Whenever a post or page is published, updated, or deleted, PolyCMS triggers an asynchronous HTTP ping notification to search engines so crawlers re-index fresh content promptly.
Submitting to Google Search Console
- Log in to Google Search Console.
- Select your property domain.
- Navigate to Sitemaps in the left sidebar.
- Enter your master sitemap index URL (
https://yourdomain.com/sitemap_index.xmlorhttps://yourdomain.com/blog/sitemap.xml) and click Submit.
Dynamic Generation & Cache Invalidation
All sitemaps are served with proper XML MIME headers (application/xml; charset=utf-8). Draft, scheduled, private, and password-protected content, No Index items reported by MTOptimize v1.4.0, and transactional PolyStore endpoints (/cart, /checkout, /my-account, /order-received) are strictly excluded from public sitemaps.
Related Documentation
- PolyStore E-Commerce Plugin - Automatic product, variant, and category XML sitemaps plus Product JSON-LD schema.
- SEO Configuration Guide - Configure MTOptimize v1.4.0, Dynamic Variant URL canonicals, and robots directives.
- Hooks & Filters Complete Reference - Full API reference for sitemap, decoupled SEO, and core extension hooks.
- Plugin Management - Activate and manage all 8 bundled plugins.
Launch Your CMS for Perfex CRM — Lifetime Access for Just $19
Create blogs, pages, themes, plugins, and manage everything from one powerful unified admin panel.
Early Adopter Advantage
Current pricing reflects the module’s present feature set. As additional plugins, themes, multilingual capabilities, builders (MTBuilder), and ecosystem integrations are released, pricing may be adjusted. Early customers secure today’s price while benefiting from future updates.