Date Range Filter Options#
Example#
The date range of the SitemapFilter
is a powerful way to control which URLs are submitted to IndexNow based on their <lastmod>
date. This is particularly useful for ensuring that only relevant and recent content is submitted.
Let's image that we have a sitemap with three URLs, each with different last modified dates:
sitemap.xml | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
Using the LaterThanAndIncluding
date range, we can target any URLs with a last modified date of March 1, 2025 or later:
Python | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
This will effectively filter out URLs outside of this date range, ensuring that only the URL https://example.com/page2
is submitted to IndexNow.
Documentation#
DateRange
#
A date range for filtering sitemap URLs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start | datetime | The start date of the range. | required |
end | datetime | The end date of the range. | required |
Example
Python | |
---|---|
1 2 3 4 5 6 7 8 9 |
|
Between
#
A date range between two not included dates for filtering sitemap URLs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start | datetime | The start date of the range (not included in evaluation). | required |
end | datetime | The end date of the range (not included in evaluation). | required |
Example
Python | |
---|---|
1 2 3 4 5 6 7 8 9 |
|
Today
#
Today as range for filtering sitemap URLs.
Example
Python | |
---|---|
1 2 3 4 5 |
|
Yesterday
#
Yesterday as range for filtering sitemap URLs.
Example
Python | |
---|---|
1 2 3 4 5 |
|
Day
#
A specific date for filtering sitemap URLs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
day | datetime | The specific day to filter sitemap URLs. | required |
Example
Python | |
---|---|
1 2 3 4 5 6 |
|
DaysAgo
#
A number of days ago from today as range for filtering sitemap URLs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
days_ago | int | The number of days ago to filter sitemap URLs. | required |
Example
Python | |
---|---|
1 2 3 4 5 |
|
LaterThan
#
Period of time after a specific date as range for filtering sitemap URLs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
date | datetime | The specific date to filter sitemap URLs. | required |
Example
Python | |
---|---|
1 2 3 4 5 6 |
|
LaterThanAndIncluding
#
Period of time after and including a specific date as range for filtering sitemap URLs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
date | datetime | The specific date to filter sitemap URLs. | required |
Example
Python | |
---|---|
1 2 3 4 5 6 |
|
EarlierThan
#
Period of time before a specific date as range for filtering sitemap URLs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
date | datetime | The specific date to filter sitemap URLs. | required |
Example
Python | |
---|---|
1 2 3 4 5 6 |
|
EarlierThanAndIncluding
#
Period of time before and including a specific date as range for filtering sitemap URLs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
date | datetime | The specific date to filter sitemap URLs. | required |
Example
Python | |
---|---|
1 2 3 4 5 6 |
|