PHP Luminova: Sitemap Generator Configurations
Configure sitemap crawl limits, URL filters, and sitemap metadata.
The Sitemap Configuration class controls how the novakit sitemap command crawls your application. The settings apply to XML sitemap generation and link audits. The link-tree mode currently produces a broken-link report. Using this class, you can:
- Limit the number of URLs to scan.
- Control the delay between requests and the maximum run time.
- Exclude specific URLs from the sitemap.
- Define a scan prefix to target certain sections of your site.
- Set patterns for extracting the last modified timestamps of pages.
- Choose which page element is used as the description in a link tree.

These options allow you to fine tune sitemap generation for better SEO and performance.
Class Definition
- Full namespace:
App\Config\Sitemap - File path:
/app/Config/Sitemap.php - This configuration derives from Luminova\Base\AbstractConfig.
- This class is final.
Properties
maxScan
Defines how many URLs to scan when generating the sitemap.
public int $maxScan = 0;- A value of
0means no limit. All accessible URLs will be scanned. - If sitemap generation slows down or uses too much memory, set a reasonable upper limit to improve performance.
scanSpeed
Specifies how many seconds to wait before scanning the next URL during sitemap generation.This delay helps control the crawling speed and reduce server load.
public int $scanSpeed = 5;Note:The minimum value is
1second. Lower values are raised to1.
maxExecutionTime
Defines the maximum time (in seconds) the sitemap generation script can run before timing out.The generator may raise PHP's execution time limit to match this value.
public int $maxExecutionTime = 300;Note: Use
0for no limit.
scanUrlPrefix
Defines the URI prefix to restrict which URLs are scanned during sitemap generation.The prefix is appended to your start URL (app.start.url in .dev.env), and only URLs that begin with the result are scanned.
public string $scanUrlPrefix = '/';How it works:
- If your start URL is
http://localhost/example.com/and you set the prefix toblog, only URLs likehttp://localhost/example.com/blog/*will be scanned. - If left empty (
''or'/'), all URLs under the start URL will be included. - The check is a plain string prefix match, so
blogalso matches/blog-archive.
Example:
public string $scanUrlPrefix = '/blog/';
// Only scans URLs like http://localhost/example.com/blog/*Note:
The crawl begins at the start URL, and that URL must also match the prefix.When you use a prefix, start the crawl from inside that section, for example with
--url.Leave the prefix empty to include everything.
changeFrequently
Specifies how often a page is expected to change,helping search engines decide how frequently to crawl it.
This setting is only a hint, search engines may still choose their own crawling schedule.
public ?string $changeFrequently = null;Valid values:
always: updated continuouslyhourly: updated at least once an hourdaily: updated at least once a dayweekly: updated at least once a weekmonthly: updated at least once a monthyearly: updated at least once a yearnever: not expected to changenull: no frequency information provided
Note:The value is written to every
<url>entry as<changefreq>exactlyas set and is not validated, so use one of the values above.
includeStaticHtml
Controls whether static .html versions of URLs are added alongsidethe dynamic URLs in the sitemap XML.
Enable this if your site provides static HTML versions of certain pages to help search engines index both variants.
public bool $includeStaticHtml = false;Example behavior:
URL:
https://example.com/pageAdded to sitemap as:
https://example.com/pagehttps://example.com/page.html(if enabled)
Sample output:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<url>
<loc>https://example.com/page</loc>
<lastmod>2024-09-21T09:22:41+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://example.com/page.html</loc>
<lastmod>2024-09-21T09:22:41+00:00</lastmod>
<priority>0.80</priority>
</url>
</urlset>Note:The root/start URL (e.g.,
https://example.com/) is never appended with.html.URLs that already contain.htmland URLs matchingskipStaticHtmlare not duplicated.
skipStaticHtml
Defines URL patterns where static .html versions should not be added to the sitemap.
Use this when certain sections (like forums, dashboards, or API endpoints) don't need static HTML counterparts. Any URL matching a pattern in this array will only include its dynamic URL.
/**
* @var string[]
*/
public array $skipStaticHtml = ['*/api/*'];Patterns follow the same rules as ignoreUrls.
Examples:
'*/foo/bar/*'skips generating.htmlfor all URLs under/foo/bar/.
Tip:This is especially useful for excluding dynamic sections that should not be indexed twice.
ignoreUrls
URLs or URL patterns to ignore while crawling. Ignored URLs are not visited, so they are not included in the sitemap XML output, and links found on other pages that match are skipped.
/**
* @var string[]
*/
public array $ignoreUrls = ['*/api/*'];Each element in the array can be:
- A full URL or URI path to exclude exactly.
- A pattern that starts with
*, followed by the part of the URL to look for.
How patterns are matched:
- The first character of a pattern is dropped and the rest is used as a case insensitive regular expression, which is searched in both the URL path and the full URL. This is why patterns are written with a leading
*. - Matching is a search, not a full match, so the pattern can match any part of the URL.
- Escape regex special characters in the rest of the pattern, and avoid using
#in a pattern.
Example:
/**
* @var string[]
*/
public array $ignoreUrls = [
'*/api/*',
'*/admin/login',
];*/admin/loginexcludes any URL containing/admin/login.
routeSegmentPatterns
Mapping last modified timestamps.
This is used to map your view templates to URI patterns so the sitemap can include the last modified date for each page.
The array stores pairs of:
- Key: the template file name (without
.php,.tpl, or.twig) - Value: the URL pattern that corresponds to that view
This helps your sitemap know which template is responsible for which URL and when it was last updated.
/**
* @var array<string, string>
*/
public array $routeSegmentPatterns = [];Note:
A mapped template is used only when the scanned page does not report its own file time.If a URL matches no pattern, the current date and time is used as the last modified value.
How to Use
Look at your web routes.
For each route, identify the view template it renders.
Add an entry in
$routeSegmentPatternsusing:- key = view file name
- value = route URL
Example:
Imagine you have a blog website with the following routes:
// /app/Controllers/Http/BlogController.php
#[Route('/')]
public function index(): int
{
return $this->view('index');
}
#[Route('/blog')]
public function blogs(): int
{
return $this->view('blogs');
}
#[Route('/blog/author/(:username)')]
public function author(): int
{
return $this->view('author');
}
#[Route('/blog/(:number)')]
public function blog(): int
{
return $this->view('blog');
}The $routeSegmentPatterns array should look like this:
/**
* @var array<string, string>
*/
public array $routeSegmentPatterns = [
'index' => '/',
'blogs' => '/blog',
'author' => '/blog/author/(:username)',
'blog' => '/blog/(:number)'
];Visual Guide: Routes → Views → Sitemap
Routes (web.php) View Templates $routeSegmentPatterns
─────────────────────────── ──────────────── ─────────────────────────
/ index.php 'index' => '/'
/blog blogs.php 'blogs' => '/blog'
/blog/author/(:username) author.php 'author' => '/blog/author/(:username)'
/blog/(:number) blog.php 'blog' => '/blog/(:number)'Notes:
- Use view file names as keys (without extensions).
- Use routes as values exactly as they appear in your routing file.
- This lets the sitemap pick the correct last modified date for each URL.
linkTreeDescriptionSelector
XPath selector used to read a page description when building a link tree. The text of the first matching element is used as the {description} value in the link tree template.
public ?string $linkTreeDescriptionSelector = null;Example:
public ?string $linkTreeDescriptionSelector = '//p[@aria-label="Subheading for this page"]';- The selector should point to an element that holds the description, such as a
<p>tag. - If the selector is
null, or nothing matches, the description is empty.
Note:This setting is intended for link-tree mode. The current implementation writes a broken-link report in that mode, so the selector does not change the output.
Command Line Overrides
The php novakit sitemap command creates this configuration and overrides these properties when the matching option is passed:
| Property | Option | Short |
|---|---|---|
maxScan | --limit | -l |
scanSpeed | --delay | -d |
scanUrlPrefix | --prefix | -p |
changeFrequently | --change | -c |
maxExecutionTime | --max-execution | -e |
includeStaticHtml | --html | -s |
linkTreeDescriptionSelector | --desc-xpath | -dx |
skipStaticHtml, ignoreUrls and routeSegmentPatterns can only be set in the configuration class.