添加IndexNow脚本
IndexNow / submit (push) Successful in 1s
Code quality / quality (push) Failing after 2s
Build and Check / Astro Check for Node.js 22 (push) Failing after 5s
Build and Check / Astro Check for Node.js 23 (push) Failing after 1s
Build and Check / Astro Build for Node.js 22 (push) Failing after 3s
Build and Check / Astro Build for Node.js 23 (push) Failing after 2s
IndexNow / submit (push) Successful in 1s
Code quality / quality (push) Failing after 2s
Build and Check / Astro Check for Node.js 22 (push) Failing after 5s
Build and Check / Astro Check for Node.js 23 (push) Failing after 1s
Build and Check / Astro Build for Node.js 22 (push) Failing after 3s
Build and Check / Astro Build for Node.js 23 (push) Failing after 2s
This commit is contained in:
1 parent
b70fcef963
commit
c66e31eb11
2 files changed
+32
No files matched your search
@@ -0,0 +1,31 @@
|
||||
name: "IndexNow"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main] # 已改为 main 分支
|
||||
schedule:
|
||||
- cron: '0 0,12 * * *' # 每天 UTC 0 点和 12 点运行
|
||||
|
||||
jobs:
|
||||
submit:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Fetch URLs from sitemap
|
||||
run: |
|
||||
# 从你的 sitemap 中提取所有 <loc> 标签内容
|
||||
curl -s "https://blog.mckero.com/sitemap-0.xml" \
|
||||
| grep -oP '(?<=<loc>)[^<]+' > urls.txt
|
||||
echo "提取到 $(wc -l < urls.txt) 个 URL"
|
||||
|
||||
- name: Submit to Bing IndexNow
|
||||
run: |
|
||||
# 取前 100 条 URL,拼成 JSON 数组(IndexNow 单次上限 10000 条)
|
||||
URLS=$(head -n 1000 urls.txt | jq -R -s -c 'split("\n") | map(select(length>0))')
|
||||
curl -s -X POST "https://www.bing.com/indexnow" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{
|
||||
\"host\": \"blog.mckero.com\",
|
||||
\"key\": \"${{ secrets.INDEXNOW_KEY }}\",
|
||||
\"keyLocation\": \"${{ secrets.INDEXNOW_KEY_LOCATION }}\",
|
||||
\"urlList\": $URLS
|
||||
}"
|
||||
@@ -0,0 +1 @@
|
||||
01a0fcc3-b711-7597-9b76-76adf8726337
|
||||
Reference in new issue
Block a user