Created
May 11, 2024 16:00
-
-
Save davlgd/8c67b2350675561e9e442734eb03b44f to your computer and use it in GitHub Desktop.
IndexNow script to send batch of URL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
key="${INDEXNOW_KEY}" | |
domain=your.domain.com | |
url_array=() | |
url_list_json=$(printf ', "%s"' "${url_array[@]}") | |
url_list_json="[ ${url_list_json:2} ]" | |
json_body=$(cat <<EOF | |
{ | |
"host": "${domain}", | |
"key": "$key", | |
"keyLocation": "https://${domain}/${key}.txt", | |
"urlList": $url_list_json | |
} | |
EOF | |
) | |
content_length=$(echo -n "$json_body" | wc -c) | |
curl -X POST -H "Content-Type: application/json" \ | |
-H "Content-Length: $content_length" \ | |
-d "$json_body" "https://api.indexnow.org/IndexNow" -v |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment