Skip to content

Sitemap module overview

Technical

To add new pages to sitemap, you need to implement \App\Modules\Sitemap\Services\Plugin and register this implementation at the config/ixdf_sitemap.php.

Sitemap file

The sitemap file is available at https://www.interaction-design.org/sitemap.xml and will be submitted to search engines.

Create a Plugin

To add contents of your modules to sitemap, you need to create a class Plugin that implements the \App\Modules\Sitemap\Services\Plugin interface.

The Plugin interface extends the Iterator interface, so you need to implement it’s features.

You iterator should iterate over all your models (that really means pages) and return \App\Modules\Sitemap\Services\Url object for each of them.

Example iterator: \App\Modules\Sitemap\Services\PagesSitemapPlugin

Register your Plugin

After you complete your plugin, you need to just register it in the sitemap service config in config/sitemap.php:

php
return [
    'dir' => 'sitemap',
    'plugins' => [
        CourseSitemapPlugin::class,
    ],
];

How to run plugin

You can simply open /sitemap.xml. If the application serves an outdated version, cleanup response chance (e.g. from /admin/nova page).

FAQ

How often our sitemap is getting updated?

The sitemap uses cache.response middleware with ttl=1hour or something like this, see the definition of the sitemap.index route.

What to do for pages which don't warrant their own plugin?

In some cases creating a separate plugin will be an overkill, for those cases simply utilize the existing PagesSitemapPlugin and add a new URL entry with the details of the new page.