jorisnoo / craft-sitemap
Zero-config XML sitemap for Craft CMS with multi-site hreflang support.
Package info
github.com/jorisnoo/craft-sitemap
Type:craft-module
pkg:composer/jorisnoo/craft-sitemap
Requires
- php: ^8.2
- craftcms/cms: ^5.0
Requires (Dev)
- laravel/pint: >=1.18.1
This package is auto-updated.
Last update: 2026-04-04 10:46:59 UTC
README
A Craft CMS module that generates a zero-config XML sitemap with multi-site hreflang support.
Features
- Generates a
sitemap.xmlwith all entries and categories that have URIs - Adds
xhtml:linkhreflang alternates for multi-site setups - Deduplicates URLs across canonical groups and sites
- No configuration required
Requirements
- PHP 8.2+
- Craft CMS 5
Installation
composer require jorisnoo/craft-sitemap
Then register the module in your config/app.php:
return [ 'modules' => [ 'craft-sitemap' => \Noo\CraftSitemap\Module::class, ], 'bootstrap' => ['craft-sitemap'], ];
The sitemap will be available at sitemap.xml on your site.
How It Works
The module registers a sitemap.xml route on your site. When requested, it:
- Queries all entries and categories with URIs across all sites
- Groups elements by their canonical ID to identify translations
- Deduplicates by site handle and URL
- Renders an XML sitemap with
<loc>,<lastmod>, and (on multi-site)<xhtml:link rel="alternate">tags
Single-site installs get a standard sitemap. Multi-site installs automatically include hreflang alternate links for each translation.
Results are cached and automatically invalidated when entries or categories are saved or deleted.
License
The MIT License (MIT). Please see LICENSE for more information.