Skip to content

Commit 5746ea3

Browse files
committed
Optimize IndexNow submission for efficiency and reliability
Switch to batch URL submission via JSON API to reduce individual requests, and add HTTP status validation to fail the workflow on submission errors.
1 parent e5f55a6 commit 5746ea3

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

.github/workflows/deploy.yml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,23 @@ jobs:
5151

5252
- name: Ping IndexNow
5353
run: |
54-
for url in \
55-
"https://csa-admin.org/" \
56-
"https://csa-admin.org/acp/" \
57-
"https://csa-admin.org/solawi/"
58-
do
59-
curl -s -o /dev/null -w "IndexNow %{url_effective} → HTTP %{http_code}\n" \
60-
"https://api.indexnow.org/indexnow?url=${url}&key=8f940d3ccbab4035acab547df3432ac0"
61-
done
54+
http_code=$(curl -s -o /tmp/indexnow-response.txt -w "%{http_code}" \
55+
-H "Content-Type: application/json; charset=utf-8" \
56+
-d '{
57+
"host":"csa-admin.org",
58+
"key":"8f940d3ccbab4035acab547df3432ac0",
59+
"keyLocation":"https://csa-admin.org/8f940d3ccbab4035acab547df3432ac0.txt",
60+
"urlList":[
61+
"https://csa-admin.org/",
62+
"https://csa-admin.org/acp/",
63+
"https://csa-admin.org/solawi/"
64+
]
65+
}' \
66+
"https://api.indexnow.org/indexnow")
67+
68+
echo "IndexNow canonical URL submission → HTTP ${http_code}"
69+
cat /tmp/indexnow-response.txt
70+
71+
if [ "${http_code}" -lt 200 ] || [ "${http_code}" -ge 300 ]; then
72+
exit 1
73+
fi

0 commit comments

Comments
 (0)