Mity Docs Mity Docs for Mity Digital
Sitemapamic Documentation

Static Site Generator

Sitemapamic works with Statamic's Static Site Generator. Can you say "Statamic's Static Site Generator" five times fast?

OK, now that's out of our system, yes, Sitemapamic works with Statamic's SSG.

There is no additional configuration required with Sitemapamic v4.

How it works

When generation starts, Sitemapamic:

  1. rebuilds each site’s sitemap, so it matches the content being exported, even if a cached copy exists;

  2. adds the sitemap’s URLs to the SSG.

The files you get depend on your mode and content:

  • automatic: sitemap.xml (the index), plus a file for each collection and taxonomy;

  • single: just sitemap.xml, unless your site is large enough to be split.

Because the file names depend on your content, you don’t need to (and shouldn’t) list them in the SSG’s urls config.

Upgrading from v3

In v3 you added sitemap.xml and each sitemap file to the urls array in config/statamic/ssg.php. Remove those entries; Sitemapamic now adds them itself.

1// config/statamic/ssg.php
2'urls' => [
3 // 'sitemap.xml', <- remove
4 // 'sitemap_pages.xml', <- remove
5],

Excluding the sitemap

If you don’t want a sitemap in your static site, exclude it with the SSG’s exclude config:

1// config/statamic/ssg.php
2'exclude' => [
3 '/sitemap*',
4],

For a multi-site setup, add a pattern for each site’s path, for example '/de/sitemap*'.

Excluding content

The SSG’s exclude config stops pages from being generated, but it doesn’t change what your sitemap lists. If you exclude a collection’s pages from the static site, also exclude the collection from Sitemapamic. Otherwise your sitemap will link to pages that don’t exist:

1// config/sitemapamic.php
2'collections' => [
3 '*',
4 'archive' => false,
5],

This applies to your sitemap everywhere, not just to the static site.

Multi-site

Sites that share a domain are all supported, whether they’re split by path (/, /de/, /fr/) or not.

The SSG generates your whole site from its one base_url. A site with its own domain (such as https://example.co.uk) is only included when that domain is the SSG’s base_url. Otherwise its sitemap would be written over the main site’s sitemap.xml, so Sitemapamic leaves it out.

Generating specific URLs

When you give ssg:generate a list of URLs, the SSG generates only those, and Sitemapamic doesn’t add anything:

1php please ssg:generate /about /contact

To regenerate just the sitemap, list its files yourself:

1php please ssg:generate /sitemap.xml /sitemap-collection-pages-1.xml

Run php please sitemapamic:list to see a site’s sitemap files.

Good to know

  • Your sitemap shows your content as it was when the site was generated. Regenerate it to pick up changes.

  • The <loc> URLs in your sitemap come from your site URLs (and APP_URL for sites with relative URLs). Make sure they’re set to your production domain when you generate.

  • Multiple workers (--workers) are supported. Each worker reads the sitemap Sitemapamic built at the start, as long as caching is enabled. With caching off, each sitemap file is rebuilt when it’s requested, which is slower but still correct.