Repository navigation
fix: 索引脚本改用线上 sitemap 做种子,修复抓不到正文 - #37
Merged
Merged
Conversation
抓取种子原来是站点根 /magicbox_doc、/en 和 /en/introduction: - /magicbox_doc(无尾斜杠)在 OSS 上 404 - /en 是没有正文的 baseUrl 提示页 - /en/introduction 页面不存在 三个种子都拿不到内容,脚本以 "Built 0 DocSearch records" 退出, magicbox_doc 的 Algolia 索引自 10-28 起一直失败。 改为先读 /sitemap.xml 与 /en/sitemap.xml(各 14 条),种子命中后再按 页面链接扩展;sitemap 不可用时回退到站点根。本地跑通:27 页 / 283 条记录。 Co-Authored-By: Claude Code <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
magicbox_doc的 Algolia 索引 workflow 自 2026-10-28 起每次失败:根因
crawlSite()的三个种子全部落空:.../magicbox_doc(无尾斜杠).../magicbox_doc/才 301 到/magicbox_doc/magicbox).../magicbox_doc/en.../magicbox_doc/en/introduction种子拿不到正文 → 0 条记录 → 脚本主动中止。站点本身是好的(
/magicbox_doc/en/faq、/magicbox_doc/quickstart等均 200)。修复
抓取前先读线上
/sitemap.xml与/en/sitemap.xml(各 14 条)做种子,命中后仍按页面链接扩展;sitemap 不可用时回退到站点根两个种子。验证
本地
ALGOLIA_ADMIN_API_KEY=dummy node scripts/algolia-index.mjs:(随后在 settings 步骤用假 key 报 403,符合预期。)合入后由
Sync gh-pages to OSS完成触发的 workflow_run 跑真实索引。相关
同款旧脚本还存在于 rdk_x_doc / rdk_s_doc / case_doc / accessories_audio_kit_doc / accessories_bmi088_doc,本次只修 magicbox,其余另行评估。
🤖 Generated with Claude Code