From c66e31eb1167ff8e5aad8c1e3cc5b43ff6d32c9b Mon Sep 17 00:00:00 2001 From: mckero Date: Fri, 2 Oct 2026 21:30:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0IndexNow=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/IndexNow.yml | 31 +++++++++++++++++++ .../01a0fcc3-b711-7597-9b76-76adf8726337.txt | 1 + 2 files changed, 32 insertions(+) create mode 100644 .github/workflows/IndexNow.yml create mode 100644 public/01a0fcc3-b711-7597-9b76-76adf8726337.txt diff --git a/.github/workflows/IndexNow.yml b/.github/workflows/IndexNow.yml new file mode 100644 index 0000000..7d1e59c --- /dev/null +++ b/.github/workflows/IndexNow.yml @@ -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 中提取所有 标签内容 + curl -s "https://blog.mckero.com/sitemap-0.xml" \ + | grep -oP '(?<=)[^<]+' > 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 + }" \ No newline at end of file diff --git a/public/01a0fcc3-b711-7597-9b76-76adf8726337.txt b/public/01a0fcc3-b711-7597-9b76-76adf8726337.txt new file mode 100644 index 0000000..39bb19c --- /dev/null +++ b/public/01a0fcc3-b711-7597-9b76-76adf8726337.txt @@ -0,0 +1 @@ +01a0fcc3-b711-7597-9b76-76adf8726337 \ No newline at end of file