[{"data":1,"prerenderedAt":752},["ShallowReactive",2],{"chapter-post-project-replication-guide-08-chapter-system-and-route-migration":3},{"chapter":4,"entry":73,"prev":285,"next":479},{"id":5,"title":6,"body":7,"category":55,"cover":52,"date":56,"description":57,"draft":58,"extension":59,"lang":60,"meta":61,"navigation":62,"path":63,"seo":64,"slug":65,"stem":66,"tags":67,"toc":62,"updated":56,"__hash__":72},"chapters/chapters/project-replication-guide.md","零基础完整复刻：Cloudflare 博客项目全流程",{"type":8,"value":9,"toc":51},"minimark",[10,14,17,30,33,45,48],[11,12,13],"p",{},"这个章节是你当前博客项目的“完整复刻手册”。",[11,15,16],{},"目标读者：",[18,19,20,24,27],"ul",{},[21,22,23],"li",{},"没有代码基础",[21,25,26],{},"第一次接触 GitHub、Cloudflare、Nuxt、Decap CMS",[21,28,29],{},"希望照着文档一步步做，最终得到与你当前项目一致的结果",[11,31,32],{},"学习方式建议：",[34,35,36,39,42],"ol",{},[21,37,38],{},"严格按顺序学习，不要跳步骤",[21,40,41],{},"每做完一节就执行“本节验收”",[21,43,44],{},"发现报错先看“常见问题”再继续",[11,46,47],{},"你可以直接从下面目录开始：",[49,50],"chapter-children",{},{"title":52,"searchDepth":53,"depth":53,"links":54},"",2,[],"Chapter","2026-02-14","面向零基础读者的完整项目复刻章节：从准备账号、搭建 Nuxt，到 Pages、Tunnel、CMS、评论、夜间模式与排障。",false,"md","zh-CN",{},true,"/chapters/project-replication-guide",{"title":6,"description":57},"project-replication-guide","chapters/project-replication-guide",[68,69,70,71],"复刻教程","Cloudflare","Nuxt","零基础","T31gU2a4Q3CvJ3Z2B2jyDvX4BtLMmICHnwzpIIudkao",{"id":74,"title":75,"body":76,"category":272,"chapterSlug":65,"cover":52,"date":56,"description":273,"draft":58,"extension":59,"lang":60,"legacySlugs":274,"meta":275,"navigation":62,"order":276,"path":277,"seo":278,"slug":279,"stem":280,"tags":281,"toc":62,"updated":56,"__hash__":284},"chapterPosts/chapter-posts/project-replication-guide/08-chapter-system-and-route-migration.md","第 8 节：章节体系（父文 + 子文 + 旧链接 301）",{"type":8,"value":77,"toc":265},[78,83,86,107,110,127,131,138,147,150,164,167,171,174,194,205,209,216,232,235,239,242,250,253,261],[79,80,82],"h2",{"id":81},"_81-章节体系是什么","8.1 章节体系是什么",[11,84,85],{},"你当前项目有 3 类内容：",[34,87,88,95,101],{},[21,89,90,91],{},"普通文章 ",[92,93,94],"code",{},"posts",[21,96,97,98],{},"章节父文 ",[92,99,100],{},"chapters",[21,102,103,104],{},"章节子文章 ",[92,105,106],{},"chapterPosts",[11,108,109],{},"路由分别是：",[18,111,112,117,122],{},[21,113,114],{},[92,115,116],{},"/posts/:slug",[21,118,119],{},[92,120,121],{},"/chapters/:chapterSlug",[21,123,124],{},[92,125,126],{},"/chapters/:chapterSlug/:slug",[79,128,130],{"id":129},"_82-目录约束为什么重要","8.2 目录约束为什么重要",[11,132,133,134,137],{},"子文章文件路径必须匹配 frontmatter 的 ",[92,135,136],{},"chapterSlug","：",[139,140,145],"pre",{"className":141,"code":143,"language":144,"meta":52},[142],"language-text","content/chapter-posts/\u003CchapterSlug>/\u003Cpost>.md\n","text",[92,146,143],{"__ignoreMap":52},[11,148,149],{},"比如：",[18,151,152,158],{},[21,153,154,155],{},"路径：",[92,156,157],{},"content/chapter-posts/machine-learning/linear-regression.md",[21,159,160,161],{},"frontmatter：",[92,162,163],{},"chapterSlug: machine-learning",[11,165,166],{},"如果不一致，构建阶段直接报错，阻止脏数据上线。",[79,168,170],{"id":169},"_83-章节正文插目录占位符","8.3 章节正文插目录占位符",[11,172,173],{},"章节正文里插入：",[139,175,178],{"className":176,"code":177,"language":59,"meta":52,"style":52},"language-md shiki shiki-themes github-light github-dark","::chapter-children\n::\n",[92,179,180,189],{"__ignoreMap":52},[181,182,185],"span",{"class":183,"line":184},"line",1,[181,186,188],{"class":187},"sVt8B","::chapter-children\n",[181,190,191],{"class":183,"line":53},[181,192,193],{"class":187},"::\n",[11,195,196,197,200,201,204],{},"渲染时会由 ",[92,198,199],{},"components/content/ChapterChildren.vue"," 自动拉取同章节子文章并按 ",[92,202,203],{},"order"," 排序。",[79,206,208],{"id":207},"_84-旧链接迁移301","8.4 旧链接迁移（301）",[11,210,211,212,215],{},"当历史链接还是 ",[92,213,214],{},"/posts/old-slug"," 时，系统会：",[34,217,218,221,227],{},[21,219,220],{},"先查普通文章",[21,222,223,224],{},"查不到再查章节子文章的 ",[92,225,226],{},"legacySlugs",[21,228,229,230],{},"命中则 301 到新地址 ",[92,231,126],{},[11,233,234],{},"这样迁移不会让旧外链失效。",[79,236,238],{"id":237},"_85-当前策略子文章只在章节体系内出现","8.5 当前策略：子文章只在章节体系内出现",[11,240,241],{},"根据你的新要求，项目已调整为：",[18,243,244,247],{},[21,245,246],{},"子文章不进入首页、全站列表、标签页等全局流",[21,248,249],{},"子文章只通过章节页目录进入",[11,251,252],{},"这让信息结构更清晰：",[18,254,255,258],{},[21,256,257],{},"首页展示“文章/章节”",[21,259,260],{},"深度内容在章节内展开",[262,263,264],"style",{},"html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":52,"searchDepth":53,"depth":53,"links":266},[267,268,269,270,271],{"id":81,"depth":53,"text":82},{"id":129,"depth":53,"text":130},{"id":169,"depth":53,"text":170},{"id":207,"depth":53,"text":208},{"id":237,"depth":53,"text":238},"Guide","实现章节化写作、章节目录占位符、子文章路由与 legacySlugs 迁移跳转。",[],{},8,"/chapter-posts/project-replication-guide/08-chapter-system-and-route-migration",{"title":75,"description":273},"08-chapter-system-and-route-migration","chapter-posts/project-replication-guide/08-chapter-system-and-route-migration",[68,282,283],"章节体系","路由迁移","09lBKEy9m61KQ_TiC-FjEgHv0NK9QVPQjZPYyqfn_v0",{"id":286,"title":287,"body":288,"category":272,"chapterSlug":65,"cover":52,"date":56,"description":467,"draft":58,"extension":59,"lang":60,"legacySlugs":468,"meta":469,"navigation":62,"order":470,"path":471,"seo":472,"slug":473,"stem":474,"tags":475,"toc":62,"updated":56,"__hash__":478},"chapterPosts/chapter-posts/project-replication-guide/07-giscus-and-comment-fix.md","第 7 节：评论系统 giscus 与空白问题修复",{"type":8,"value":289,"toc":457},[290,294,297,319,326,330,333,341,347,350,358,362,365,376,385,439,443],[79,291,293],{"id":292},"_71-giscus-必备参数","7.1 giscus 必备参数",[11,295,296],{},"你需要从 giscus 配置页记录：",[34,298,299,304,309,314],{},[21,300,301],{},[92,302,303],{},"repo",[21,305,306],{},[92,307,308],{},"repoId",[21,310,311],{},[92,312,313],{},"category",[21,315,316],{},[92,317,318],{},"categoryId",[11,320,321,322,325],{},"你的当前值是基于仓库 ",[92,323,324],{},"adkeb/blog","。",[79,327,329],{"id":328},"_72-环境变量要在两个环境都填","7.2 环境变量要在两个环境都填",[11,331,332],{},"Cloudflare Pages 里：",[18,334,335,338],{},[21,336,337],{},"Production 环境变量",[21,339,340],{},"Preview 环境变量",[11,342,343,344,325],{},"都要填同样的 ",[92,345,346],{},"GISCUS_*",[11,348,349],{},"否则表现会是：",[18,351,352,355],{},[21,353,354],{},"线上能加载、预览不加载",[21,356,357],{},"或者反过来",[79,359,361],{"id":360},"_73-你遇到的评论空白问题","7.3 你遇到的评论空白问题",[11,363,364],{},"问题现象：",[34,366,367,370,373],{},[21,368,369],{},"登录 GitHub 回来后评论区空白",[21,371,372],{},"刷新当前页面后又空白",[21,374,375],{},"需要手动关弹窗/重进才恢复",[377,378,380,381,384],"h3",{"id":379},"修复点componentsgiscuscommentsclientvue","修复点（",[92,382,383],{},"components/GiscusComments.client.vue","）",[34,386,387,402,413,428],{},[21,388,389,390,393,394,397],{},"监听 ",[92,391,392],{},"focus"," 和 ",[92,395,396],{},"visibilitychange",[18,398,399],{},[21,400,401],{},"从 GitHub 授权窗口返回时，自动重新挂载 giscus。",[21,403,404,405,408],{},"把加载策略改为 ",[92,406,407],{},"eager",[18,409,410],{},[21,411,412],{},"避免懒加载时机导致 iframe 空白。",[21,414,415,416,419,420,423],{},"路由监听从 ",[92,417,418],{},"fullPath"," 收敛到 ",[92,421,422],{},"path",[18,424,425],{},[21,426,427],{},"减少不必要重挂载。",[21,429,430,431,434],{},"主题切换时向 iframe ",[92,432,433],{},"postMessage",[18,435,436],{},[21,437,438],{},"避免夜间模式切换导致评论状态不一致。",[79,440,442],{"id":441},"_74-验收步骤","7.4 验收步骤",[34,444,445,448,451,454],{},[21,446,447],{},"打开任意文章页，确认评论可见。",[21,449,450],{},"点击登录并完成 GitHub 授权。",[21,452,453],{},"回到页面后无需手动刷新即可评论。",[21,455,456],{},"手动刷新页面，评论区仍正常渲染。",{"title":52,"searchDepth":53,"depth":53,"links":458},[459,460,461,466],{"id":292,"depth":53,"text":293},{"id":328,"depth":53,"text":329},{"id":360,"depth":53,"text":361,"children":462},[463],{"id":379,"depth":464,"text":465},3,"修复点（components/GiscusComments.client.vue）",{"id":441,"depth":53,"text":442},"配置 giscus 参数、环境变量同步，并修复登录后评论空白、刷新后评论空白问题。",[],{},7,"/chapter-posts/project-replication-guide/07-giscus-and-comment-fix",{"title":287,"description":467},"07-giscus-and-comment-fix","chapter-posts/project-replication-guide/07-giscus-and-comment-fix",[68,476,477],"giscus","评论系统","Q3kyHNdaPbn0boCYo_SD58Gnw4JEPaGtjktQD-56xa8",{"id":480,"title":481,"body":482,"category":272,"chapterSlug":65,"cover":52,"date":56,"description":740,"draft":58,"extension":59,"lang":60,"legacySlugs":741,"meta":742,"navigation":62,"order":743,"path":744,"seo":745,"slug":746,"stem":747,"tags":748,"toc":62,"updated":56,"__hash__":751},"chapterPosts/chapter-posts/project-replication-guide/09-dark-mode-and-final-checklist.md","第 9 节：夜间模式、最终检查与上线清单",{"type":8,"value":483,"toc":733},[484,488,491,550,554,557,568,572,575,652,655,659,703,707,710,727,730],[79,485,487],{"id":486},"_91-夜间模式实现点","9.1 夜间模式实现点",[11,489,490],{},"本项目夜间模式不是“切一段类名”这么简单，而是完整主题体系：",[34,492,493,513,523,540],{},[21,494,495,498],{},[92,496,497],{},"composables/useTheme.ts",[18,499,500,507,510],{},[21,501,502,503,506],{},"维护 ",[92,504,505],{},"light/dark"," 状态",[21,508,509],{},"读取系统偏好",[21,511,512],{},"localStorage 持久化",[21,514,515,518],{},[92,516,517],{},"plugins/theme.client.ts",[18,519,520],{},[21,521,522],{},"页面启动时初始化主题，减少闪屏",[21,524,525,528],{},[92,526,527],{},"assets/css/main.css",[18,529,530],{},[21,531,532,535,536,539],{},[92,533,534],{},":root"," 与 ",[92,537,538],{},":root[data-theme=\"dark\"]"," 双变量集",[21,541,542,545],{},[92,543,544],{},"components/SiteHeader.vue",[18,546,547],{},[21,548,549],{},"提供“夜间/日间”切换按钮",[79,551,553],{"id":552},"_92-为什么这种做法更稳","9.2 为什么这种做法更稳",[11,555,556],{},"优点：",[34,558,559,562,565],{},[21,560,561],{},"不绑定具体页面组件，任何页面都自动继承主题。",[21,563,564],{},"主题变量统一管理，后续改色只改一处。",[21,566,567],{},"与 giscus 评论联动，避免评论 iframe 主题不同步。",[79,569,571],{"id":570},"_93-发布前最终命令清单","9.3 发布前最终命令清单",[11,573,574],{},"每次发布前执行：",[139,576,580],{"className":577,"code":578,"language":579,"meta":52,"style":52},"language-bash shiki shiki-themes github-light github-dark","npm run check\nnpm run generate\ngit status\ngit add .\ngit commit -m \"your message\"\ngit push origin main\n","bash",[92,581,582,595,604,612,623,638],{"__ignoreMap":52},[181,583,584,588,592],{"class":183,"line":184},[181,585,587],{"class":586},"sScJk","npm",[181,589,591],{"class":590},"sZZnC"," run",[181,593,594],{"class":590}," check\n",[181,596,597,599,601],{"class":183,"line":53},[181,598,587],{"class":586},[181,600,591],{"class":590},[181,602,603],{"class":590}," generate\n",[181,605,606,609],{"class":183,"line":464},[181,607,608],{"class":586},"git",[181,610,611],{"class":590}," status\n",[181,613,615,617,620],{"class":183,"line":614},4,[181,616,608],{"class":586},[181,618,619],{"class":590}," add",[181,621,622],{"class":590}," .\n",[181,624,626,628,631,635],{"class":183,"line":625},5,[181,627,608],{"class":586},[181,629,630],{"class":590}," commit",[181,632,634],{"class":633},"sj4cs"," -m",[181,636,637],{"class":590}," \"your message\"\n",[181,639,641,643,646,649],{"class":183,"line":640},6,[181,642,608],{"class":586},[181,644,645],{"class":590}," push",[181,647,648],{"class":590}," origin",[181,650,651],{"class":590}," main\n",[11,653,654],{},"然后去 Cloudflare Pages 看 deployment 是否成功。",[79,656,658],{"id":657},"_94-线上验收清单逐条打勾","9.4 线上验收清单（逐条打勾）",[34,660,661,667,676,682,685,688,694,697,700],{},[21,662,663,666],{},[92,664,665],{},"https://www.xuyangfly.site"," 可访问",[21,668,669,672,673],{},[92,670,671],{},"https://xuyangfly.site"," 会 301 到 ",[92,674,675],{},"www",[21,677,678,681],{},[92,679,680],{},"/admin"," 可以登录并发布",[21,683,684],{},"评论区加载正常，登录后不会空白",[21,686,687],{},"夜间模式可切换，刷新后记住状态",[21,689,690,693],{},[92,691,692],{},"/chapters"," 能看到章节目录",[21,695,696],{},"章节内子文章可访问并有上下篇",[21,698,699],{},"普通文章链路不受影响",[21,701,702],{},"RSS / Sitemap / Search Index 可访问",[79,704,706],{"id":705},"_95-你已经得到什么","9.5 你已经得到什么",[11,708,709],{},"到这一步，你拥有的是一个可以长期迭代的博客系统，而不是一次性演示页：",[34,711,712,715,718,721,724],{},[21,713,714],{},"有稳定发布路径",[21,716,717],{},"有安全边界",[21,719,720],{},"有可视化运营后台",[21,722,723],{},"有评论互动",[21,725,726],{},"有章节化知识沉淀结构",[11,728,729],{},"这正是“可持续维护”的技术项目形态。",[262,731,732],{},"html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":52,"searchDepth":53,"depth":53,"links":734},[735,736,737,738,739],{"id":486,"depth":53,"text":487},{"id":552,"depth":53,"text":553},{"id":570,"depth":53,"text":571},{"id":657,"depth":53,"text":658},{"id":705,"depth":53,"text":706},"完成夜间模式与主题持久化，给出发布前最终检查清单，确保你能稳定长期维护。",[],{},9,"/chapter-posts/project-replication-guide/09-dark-mode-and-final-checklist",{"title":481,"description":740},"09-dark-mode-and-final-checklist","chapter-posts/project-replication-guide/09-dark-mode-and-final-checklist",[68,749,750],"夜间模式","验收","DboPhn-EXjKFLtWP6yV2iw8FlZMQObgE7QyRDhXPHeo",1771232916066]