Luminova Framework

Sitemap Configuration

Last updated: 2024-05-22 23:05:39

The Sitemap Configuration class provides properties to configure the generation of sitemaps in your application, allowing you to set limits on the number of URLs to scan, specify URLs to ignore, and define patterns for extracting URLs view last-modified timestamp.

  • Class namespace: \App\Controllers\Config\Sitemap
  • File path: /app/Controllers/Config/Sitemap.php
  • This class is marked as final and can't be subclassed



The maximum limit of URLs to scan when generating the sitemap.

public int $maxScan = 0;

A value of 0 (zero) indicates no limit, meaning all accessible URLs will be scanned.

If you encounter performance issues or memory constraints, consider setting a reasonable limit.


URLs, URL patterns, or full URLs to ignore when generating a sitemap.

public array<int,string> $ignoreUrls = [];

This array defines specific URLs, URL patterns, or full URLs that should be ignoredwhen generating a sitemap. Ignored URLs will not be included in the sitemap XML output.

Each element in the array can be:

  • A full URL to completely exclude from the sitemap.
  • A URL pattern using wildcard characters (*) to match and exclude multiple URLs.Example: ✸/admin/login/✸ will match any URL containing ✸/admin/login/✸ and exclude them.


URL patterns associated with views for determining last modified timestamps in a sitemap.

public array<string,string> $viewUrlPatterns = [];

This array defines URL patterns corresponding to views within your application. When generatinga sitemap, these patterns are used to identify views and retrieve their last modified timestamps.

To utilize dynamic last-modified date in sitemap, register URL patterns that match your web routing patterns. Use the arraykey to represent the view file name associated with each pattern, without the extension [.php, .tpl or .twig].


Assuming you create a blog website and you would like to include the last modify date in sitemap.

In this example we assume your routing web.php look like below.

  $router->get('/', 'BlogController::index');
  $router->bind('/blog', function(Router $router) {
  $router->get('/', 'BlogController::blogs');
  $router->get('/author/([0-9-.]+)', 'BlogController::author');
  $router->get('/([0-9-.]+)', 'BlogController::blog');

Now with the above routing setup, your $viewUrlPatterns patterns should look like below

public array $viewUrlPatterns = [
  'index' => '/',
  'blogs' => '/blog',
  'author' => '/blog/author/([0-9-.]+)',
  'blog' => '/blog/([0-9-.]+)'

In the above example, the array values are exactly same as the the routing of our blog website example.

While the keys indicate the template view file name which is responsible in rendering the routes.

Note: The array keys are not same with the controller method name.