Contensio logo

Sitemap Generator

XML sitemap at /sitemap.xml — configure changefreq and priority per content type, include/exclude types, auto-ping Google and Bing on publish.

About this plugin

Sitemap Generator - Contensio Plugin

Configures the XML sitemap at /sitemap.xml. Set changefreq and priority per content type, include or exclude whole types, and automatically ping Google and Bing when content is published.


Features

  • Per-type configuration - set changefreq and priority independently for the homepage, blog index, pages, posts, and taxonomy archive pages
  • Include / exclude - toggle each content type on or off without affecting others
  • Search engine pings - automatically pings Google and Bing whenever a content item is published or a scheduled item goes live
  • Live sitemap preview - link to /sitemap.xml directly from the settings page
  • Zero configuration - sensible defaults work out of the box; install and forget

How it works

The core Contensio sitemap at /sitemap.xml builds a URL list and passes it through the contensio/seo/sitemap-urls filter. This plugin hooks into that filter to:

  1. Remove URLs whose type is disabled in settings.
  2. Override changefreq and priority with the configured values.

On publish, the plugin listens on contensio/content/status-changed (and contensio/content/published for scheduled items). When content transitions to published, it fires HTTP pings to the configured search engines in a best-effort manner - a failed ping is logged but never interrupts the publish action.


Installation

Via admin panel

Go to Plugins in your Contensio admin, find Sitemap Generator, and click Install.

Via Composer

composer require contensio/plugin-sitemap

The plugin is auto-discovered. Go to Plugins in the admin and enable it. No migration is needed - settings are stored in the core settings table.


Admin settings (/account/settings/sitemap)

Content types

Type Description
Homepage The site root (/)
Blog index The /blog listing page
Pages All published static pages
Posts All published blog posts
Taxonomies Category and tag archive pages

For each type you can:

  • Include - check to include in the sitemap; uncheck to exclude entirely
  • Change frequency - hint to crawlers how often the content changes (always / hourly / daily / weekly / monthly / yearly / never)
  • Priority - relative importance within your site (1.0 = highest, 0.1 = lowest)

Search engine pings

Setting Description
Ping Google Sends GET https://www.google.com/ping?sitemap=… on each publish (deprecated by Google in 2023 - submit via Search Console for reliable indexing)
Ping Bing Sends GET https://www.bing.com/webmaster/ping.aspx?siteMap=… on each publish

Default values

Type Included changefreq priority
Homepage daily 1.0
Blog index daily 0.9
Pages weekly 0.7
Posts weekly 0.6
Taxonomies weekly 0.5

Routes

Method URL Description
GET /account/settings/sitemap Sitemap settings page
POST /account/settings/sitemap Save sitemap settings

The sitemap itself is served by the core at /sitemap.xml - this plugin configures it, not replaces it.


Developer: filter hook

Other plugins can also modify the sitemap URL list by registering on the same filter:

use Contensio\Support\Hook;

Hook::addFilter('contensio/seo/sitemap-urls', function (array $urls): array {
    // Add a custom URL
    $urls[] = [
        'type'       => 'custom',
        'loc'        => url('/my-custom-page'),
        'lastmod'    => now()->toAtomString(),
        'changefreq' => 'monthly',
        'priority'   => '0.4',
    ];
    return $urls;
});

Each URL entry is an associative array with loc, lastmod, changefreq, priority, and an optional type key. The type key is internal metadata - it is stripped before XML output.


Requirements

  • PHP 8.2+
  • Contensio 2.0+

License

AGPL-3.0-or-later - see LICENSE.