CleanDeck automatically generates a sitemap for your application.
By default, the sitemap is available through the endpoint GET /sitemap.xml. The default sitemap endpoint is specified also by file Application/public/robots.txt.
The sitemap is built using two types of sources:
- entries generated by CMD-Auth which covers articles and FAQs
- any GET endpoints having sitemap instructions (see below section 2. Custom Sitemap)
When adding or editing articles and FAQs, CMD-Auth requires valid sitemap data.
No further action required from your side.
When defining GET routes in files GETRoutes.php, you can provide sitemap instruction through the $sitemap_settings parameter of method $routes->add(...).
When using $sitemap_settings the following standard sitemap instructions can be provided for each GET route:
- changefreq (mandatory)
- priority (mandatory)
- other standard sitemap instructions
For example:
// file Application/Instance/Routes/GETRoutes.php
$routes->add(
'/',
HomeController::class,
'index',
[
AAAInit::class,
ApplicationStatusJWT::class,
UserDetails::class,
HttpCaching::class => ['interval' => 3600],
CSP::class,
SEO::class,
],
[
'changefreq' => 'daily',
'priority' => 0.9,
]
);
The Sitemap and SEO optimizations are decoupled. An endpoint can be added to sitemap without being SEO optimized.
SEO optimizations can be enabled by adding SEO::class to the list of middleware for each GET endpoint.