Mity Docs Mity Docs for Mity Digital
Sitemapamic Documentation

Defaults

Each URL in a sitemap can have a <changefreq> and a <priority>. Sitemapamic reads these from fields on your entries and terms (see Blueprints). When a field has no valid value, the defaults are used instead.

1'defaults' => [
2 'changefreq' => null,
3 'priority' => null,
4],

Option

Default

Description

changefreq

null

One of always, hourly, daily, weekly, monthly, yearly or never.

priority

null

A number from 0 to 1.

When a default is null, the element is left out of any URL that doesn't set its own value. That is the default, and it's a sensible one: search engines treat both elements as hints at most.

Global defaults

Set a value in defaults to use it for every entry and term without its own:

1'defaults' => [
2 'changefreq' => 'weekly',
3 'priority' => 0.5,
4],

Collection and Taxonomy defaults

A Collection or Taxonomy can set its own defaults in the collections and taxonomies options. These are used instead of the global defaults:

1'collections' => [
2 '*',
3 'pages' => [
4 'changefreq' => 'yearly',
5 'priority' => 0.8,
6 ],
7 'blog' => [
8 'changefreq' => 'daily',
9 ],
10],
11 
12'taxonomies' => [
13 '*',
14 'tags' => [
15 'priority' => 0.3,
16 ],
17],

Each key falls back on its own. Here, blog entries use daily with the global priority.

Giving a Collection or Taxonomy options also selects it, even without '*'. A Collection selected this way lists its entries only, unless you give it a taxonomies key too. See Content Discovery.

Term pages within a Collection

Contextual term pages, such as /blog/tags/laravel, use their Taxonomy's defaults, not the Collection's. In the example above, those pages would use the tags priority of 0.3.

How a value is chosen

For each entry or term, Sitemapamic uses the first valid value from:

  1. the entry's or term's mapped field

  2. its Collection's or Taxonomy's defaults

  3. the global defaults

A field value that isn't valid, such as a priority of 2, falls through to the defaults.

Validation

A default that isn't valid, such as 'changefreq' => 'fortnightly' or 'priority' => 1.5, throws an InvalidArgumentException when the sitemap is built, naming the option to fix. Numeric strings such as '0.5' are accepted for priority, so values from env() work.