Submit Multiple Sitemaps to the IndexNow API#
submit_sitemaps_to_index_now()#
Submit multiple sitemaps to the IndexNow API of a search engine.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
authentication | IndexNowAuthentication | Authentication credentials for the IndexNow API. | required |
sitemap_locations | list[str] | List of sitemap locations to submit, e.g. | required |
filter | SitemapFilter | None | Optional filter for URLs. Ignored by default or if set to | None |
endpoint | SearchEngineEndpoint | str | Select the search engine you want to submit to or use a custom URL as endpoint. | INDEXNOW |
Returns:
| Name | Type | Description |
|---|---|---|
int | int | Status code of the response, e.g. |
Example
After adding your authentication credentials to the IndexNowAuthentication class, you can now submit multiple sitemaps to the IndexNow API:
| Python | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
If you want to submit to a specific search engine, alternatively customize the endpoint:
15 16 | |
If you want to only upload a portion of the sitemap URLs, apply the skip and take parameters in the SitemapFilter class:
| Python | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | |
Instead of filtering by amount, you can filter by last modified date using the date_range parameter. Firstly, add one of the date range options to the imports, e.g. DaysAgo:
1 | |
Then use the date_range parameter to filter URLs by last modified date:
15 | |
Or target URLs with a specific pattern using the contains parameter:
15 | |
The contains parameter also accepts regular expressions for more advanced filtering:
15 | |
Or use the excludes parameter to exclude URLs that match a specific pattern:
15 | |
Or combine all the contains and excludes, skip and take, date_range and other parameters to filter the URLs even further:
15 16 17 18 19 20 21 | |