Sitemaps
Advanced SEO generates sitemaps for all of your collections and taxonomies. The sitemaps are organized in a sitemap index, which can be accessed at /sitemap.xml
.
Disable Sitemaps
You may globally disable the sitemap feature by setting enabled
to false
in the config:
Disabling Collections & Taxonomies
There are several ways to disable a collection or taxonomy from generating sitemaps.
Disabled Collection or Taxonomy
Sitemaps won't be created for any collection or taxonomy that has been disabled in the config:
Excluded collections and taxonomies
Sitemaps won't be created for any collection or taxonomy that has been configured to be excluded from the sitemap in the Indexing site defaults:
Enabled Noindex
Sitemaps won't be created if Noindex
has been enabled in the Indexing site defaults:
Excluding entries and terms
A couple of factors determine whether an individual entry or term will be excluded from the sitemaps.
Disabled Sitemap
An entry or term will be excluded from the sitemap if the toggle is disabled:
Enabled Noindex
An entry or term will be excluded from the sitemap if Noindex has been enabled:
Canonical URL
An entry or term will be excluded from the sitemap if the canonical URL is anything else but Current Entry
or Current Term
. In the following example, the entry will be excluded from the sitemap:
Generating sitemaps
Sitemaps are generated on demand whenever a sitemap is visited on the front end. If you have a content-heavy site, this might take a lot of resources and, in some cases, even result in a timeout.
To combat this issue, you may generate the sitemaps with the following command:
Add the --queue
flag to generate the sitemaps in the background:
The recommended way to go about generating your sitemaps is to schedule the command:
You may change the path where your generated sitemaps are saved in the config:
Custom Sitemaps
Custom sitemaps are a great tool to add any Statamic or Laravel route to Advanced SEO's sitemaps.
Use the Sitemap::register()
method to register a custom sitemap in a service provider. The method expects a closure and needs to return a sitemap.
You also have the option to move the sitemap-related code into its own class.
The sitemap class needs to extend the BaseSitemap
and implement the urls()
method.
Last updated