Appearance
IndexNow 提交
IndexNow 只需要在文章发布或更新后提交 canonical URL。项目脚本会从正式 XML sitemap 或本地构建产物读取 URL,并一次性提交给 IndexNow。
首次配置
生成一个 8-128 位、只含字母/数字/连字符的 key,例如:
bashopenssl rand -hex 16在
public/创建<key>.txt,文件内容只能是 key 本身。提交并部署,使它可以通过https://www.chatgpt-china-guide.com/<key>.txt访问。
提交已部署文章
bash
INDEXNOW_KEY='<key>' npm run seo:indexnow脚本默认读取 https://www.chatgpt-china-guide.com/sitemap.xml,提交前会检查线上 key 文件内容是否匹配。
提交刚构建的 sitemap
bash
npm run build
INDEXNOW_KEY='<key>' npm run seo:indexnow -- --sitemap=.vitepress/dist/sitemap.xml也可以只提交指定 URL:
bash
INDEXNOW_KEY='<key>' \
INDEXNOW_URLS='https://www.chatgpt-china-guide.com/chatgpt/example,https://www.chatgpt-china-guide.com/gemini/example' \
npm run seo:indexnow不要提交重定向源、非 canonical 域名或草稿页。IndexNow 是“通知抓取”,不保证收录或排名;sitemap 和 robots.txt 仍需保持正常。