Sitemap Filter Settings#
Example#
When you want full control over which URLs are submitted to IndexNow, the SitemapFilter
can help. Let's imagine a basic sitemap with three URLs, each with different properties:
sitemap.xml | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
The date range filter options can ensure that only URLs that has been modified in 2025 are submitted to IndexNow, and furthermore we can exclude any URLs that contain the word page
. This will effectively submit the URL https://example.com
to IndexNow because it is the only one that meets these criteria:
Python | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
Documentation#
SitemapFilter
#
Configuration class for filtering sitemap URLs based on text, change frequency, date ranges and other criteria.
Attributes:
Name | Type | Description |
---|---|---|
change_frequency | ChangeFrequency | str | None | Optional filter for URLs based on change frequency, e.g. |
date_range | DateRange | None | Optional filter for URLs based on a date range, e.g. |
contains | str | None | Optional filter for URLs. Can be simple string (e.g. |
excludes | str | None | Optional filter for URLs. Can be simple string (e.g. |
skip | int | None | Optional number of URLs to be skipped. Ignored by default or if set to |
take | int | None | Optional limit of URLs to be taken. Ignored by default or if set to |
Example
Get all URLs containing section1
:
Python | |
---|---|
1 2 3 |
|
Get all URLs that contain either section1
or section2
:
Python | |
---|---|
1 2 3 |
|
Exclude any URL that contains section3
:
Python | |
---|---|
1 2 3 |
|
Only the URLs modified within the past 2 days:
Python | |
---|---|
1 2 3 |
|
Get all URLs from January, 2025:
Python | |
---|---|
1 2 3 4 5 6 7 8 9 |
|
Get all URLs with a change frequency set to daily
:
Python | |
---|---|
1 2 3 |
|
From a large sitemap, skip the first 10 URLs and take the next 20 URLs:
Python | |
---|---|
1 2 3 |
|