How to Customise Your Workflow Parameters#
Using the flexible parameters, you can submit individual or multiple URLs, or even entire or partial sitemaps, to IndexNow on a regular basis. Find out how based on the following example:
.github/workflows/submit_sitemap_to_index_now.yml | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
Overview#
Parameter | Required | Description | Default |
---|---|---|---|
host | Yes | The host of your website, e.g. example.com . | None |
api_key | Yes | The API key for IndexNow, e.g. a1b2c3d4 . | None |
api_key_location | Yes | The location of the API key, e.g. https://example.com/a1b2c3d4.txt . | None |
endpoint | Optional | The search engine endpoint, e.g. indexnow , bing , naver , seznam , yandex , yep . | bing |
urls | Optional | The URL(s) to be submitted, e.g. https://example.com . | None |
sitemap_locations | Optional | The location of the sitemap(s), e.g. https://example.com/sitemap.xml . | None |
sitemap_filter | Optional | Only submit sitemap URLs that contain the filter string, e.g. section1 . | None |
sitemap_days_ago | Optional | Only submit sitemap URLs that have been modified recently based on the <lastmod> tag, e.g. 1 , 2 , or more days ago. | None |
Parameters#
host
#
Contains the domain (and subdomain) of your website. Required every time you submit any URLs or sitemaps to the IndexNow API.
For example, if the URL to your sitemap is https://example.com
, then the host
parameter should be example.com
:
.github/workflows/submit_sitemap_to_index_now.yml | |
---|---|
14 |
|
Or if your website URL is https://www.example.com
, then the host
should be www.example.com
:
.github/workflows/submit_sitemap_to_index_now.yml | |
---|---|
14 |
|
api_key
#
The API key for IndexNow, e.g. a1b2c3d4
. Required every time you submit any URLs or sitemaps to the IndexNow API.
You need to set an API key on your website to verify ownership of your domain. This should be kept secret and is required every time you submit a URL to the IndexNow API:
.github/workflows/submit_sitemap_to_index_now.yml | |
---|---|
15 |
|
If you don't want to use the API key generator from Microsoft Bing, you can create your own API key.
How to Keep Your API Key Secure
IndexNow requires an API key stored on your website, but how do you keep it secret and secure?
For public repositories, you normally can't hide your IndexNow API key and its location – the file is visible in the repository code and the API key is exposed. It's therefore recommended to store your API key as a secret in your repository.
api_key_location
#
The location of the API key, e.g. https://example.com/a1b2c3d4.txt
. Required every time you submit any URLs or sitemaps to the IndexNow API.
Similar to the api_key
, the location of your API key should be kept secret:
.github/workflows/submit_sitemap_to_index_now.yml | |
---|---|
16 |
|
endpoint
#
Optional. The search engine endpoint, e.g. indexnow
, bing
, naver
, seznam
, yandex
, yep
. If not specified, Bing is used as the default endpoint.
.github/workflows/submit_sitemap_to_index_now.yml | |
---|---|
17 |
|
Warning
It is not recommended to submit the same URLs to multiple endpoints. Once you have successfully submitted to one IndexNow endpoint, the IndexNow service is designed to propagate your URLs to other search engines, so you do not need to submit to multiple times.
urls
#
Optional. The URL(s) to be submitted to IndexNow. Can be an individual URL, e.g. https://example.com
:
.github/workflows/submit_sitemap_to_index_now.yml | |
---|---|
18 |
|
Or multiple URLs as list:
.github/workflows/submit_sitemap_to_index_now.yml | |
---|---|
18 |
|
Alternatively over multiple lines, if that's easier to read:
.github/workflows/submit_sitemap_to_index_now.yml | |
---|---|
18 19 20 |
|
sitemap_locations
#
Optional. The location of the sitemap(s) from which the URLs will be submitted to IndexNow. Can be an individual sitemap, e.g. https://example.com/sitemap.xml
:
.github/workflows/submit_sitemap_to_index_now.yml | |
---|---|
19 |
|
Or multiple sitemaps as list:
.github/workflows/submit_sitemap_to_index_now.yml | |
---|---|
19 |
|
Alternatively over multiple lines, if that's easier to read:
.github/workflows/submit_sitemap_to_index_now.yml | |
---|---|
19 20 21 |
|
sitemap_filter
#
Optional. Only submit sitemap URLs that contain the filter string, e.g. section1
. Optional.
.github/workflows/submit_sitemap_to_index_now.yml | |
---|---|
20 |
|
Or filter the sitemap URLs for both section1
and section2
using a regular expression:
.github/workflows/submit_sitemap_to_index_now.yml | |
---|---|
20 |
|
Alternatively, imagine that you want to prevent a whole section from being submitted. This can be achieved using a negative regular expression. This will match any URL that does not include the string /section1/
:
.github/workflows/submit_sitemap_to_index_now.yml | |
---|---|
20 |
|
sitemap_days_ago
#
Optional. Only submit sitemap URLs that have been modified recently based on the <lastmod>
tag, e.g. 1
, 2
, or more days ago.
For example, all sitemap URLs that have been modified in the last week days will be submitted:
.github/workflows/submit_sitemap_to_index_now.yml | |
---|---|
21 |
|
Or only submit sitemap URLs that have been modified since yesterday:
.github/workflows/submit_sitemap_to_index_now.yml | |
---|---|
21 |
|
Or only submit sitemap URLs that have been modified today:
.github/workflows/submit_sitemap_to_index_now.yml | |
---|---|
21 |
|