Mity Docs Mity Docs for Mity Digital
Sitemapamic Documentation

Options

If you haven't already, make sure you publish Sitemapamic's config file - you'll need to do this:

1php artisan vendor:publish --tag=sitemapamic-config

This will publish the config file to config/sitemapamic.php. Look at this file - in there you can adjust the cache key, plus the defaults for each collection and configuration for the globals. You'll also see examples for both defaults and globals, just to help you out. We've included comments throughout to help make it easy for you to understand how to tweak Sitemapamic to meet your needs.

Options

These options help manage Sitemapamic's performance and behaviour.

cache

Sitemapamic will store its output in Laravel's cache using this key. You probably won't ever need to change this, but it's here if you need it.

ttl

By default, Sitemapamic will hold on to your sitemap forever. Well, until an Entry, Term, Taxonomy or Collection is saved or deleted.

But you can use the ttl property to define a custom lifetime for your cache, in case you want it to get re-built more often.

The easiest thing to do is pass a number of seconds as the ttl value. You can also use a DateInterval if you'd prefer too - anything that Laravel's Cache::put accepts as a ttl will work beautifully here.

mode New

From v2.2.0, Sitemapamic supports multiple sitemaps which splits your sitemaps in to collection and taxonomy sub-sitemaps.

You still have one sitemap.xml route, but this then links to individual sitemaps for each section of your site.

To enable this feature, set the mode attribute to multiple in the sitemapamic.php config file:

1return [
2 'mode' => 'multiple',
3];

Learn more about sitemaps for large sites.

By default, mode will be set to single, even if it is missing in your config file.

Defaults

The defaults is an array with a key being the handle of a Collection, and a number of properties.

For example, your blog could have a frequency set to weekly (as they get posted often) but your content pages are set to yearly (as they don't change much at all).

1'defaults' => [
2 'blog' => [
3 'include' => true,
4 'frequency' => 'weekly',
5 'priority' => '0.7',
6 'includeTaxonomies' => true,
7 ],
8 
9 'pages' => [
10 'include' => true,
11 'frequency' => 'yearly',
12 'priority' => '0.5',
13 ]
14],

include

When true will automatically include entries from this collection. Set to false to not include them by default.

This can be overridden per entry using the meta_include_in_xml_sitemap field (see Blueprint requirements).

frequency

The default value for the <changefreq> tag in your sitemap for each entry.

Leave blank (and not have a meta_change_frequency field in your blueprint) will exclude this tag from your sitemap for that Collection's entries.

This can be overridden per entry using the meta_change_frequency field (see Blueprint requirements).

priority

The default value for the <priority> tag in each entry's <url> in the sitemap XML.

Leave blank (and not have a meta_priority field in your blueprint) will exclude this tag from your sitemap for that Collection's entries.

This can be overridden per entry using the meta_priority field (see Blueprint requirements).

includeTaxonomies

When set to true, taxonomy links will be created for the collection, if your entries use them.

Taxonomy terms can also use a meta_include_in_xml_sitemap field in their blueprint to optionally force-exclude a term from your sitemap. See Blueprint requirements for field details.

Globals

Globals are not about Collections, but for additional URLs that come from Statamic. You can define settings for your global Taxonomies here.

The configuration settings are the same as for Defaults - so you can override the same three fields in your Term blueprint if you need.

This example would set the <changefreq> and <priority> for the Tags Taxonomy, but neither for the Categories Taxonomy.

1'globals' => [
2 'taxonomies' => [
3 'tags' => [
4 'frequency' => 'yearly',
5 'priority' => '0.5',
6 ],
7 
8 'categories' => []
9 ]
10]

Field Mappings New

Added in 2.3.8, the mappings configuration property allows you to map Sitemapamic's opinionated Blueprint Requirements to your own fields.

There are 3 fields to map:

  • include in sitemap (include)

  • change frequency (change_frequency)

  • priority (priority)

If you're getting started with Sitemapamic 2.3.8 or later, the published config file will have the mappings read to go. If you're upgrading and want to map your own fields, you need to add the mappings block to your config/sitemapamic.php config file.

1'mappings' => [
2 'include' => 'sitemap_include',
3 'change_frequency' => 'sitemap_change_frequency',
4 'priority' => 'sitemap_priority',
5]

The values of each of these keys is a handle within your entry blueprint.

Refer to the Blueprint Requirements for Sitemapamic's defaults - but you can now make your own fields.