[{"data":1,"prerenderedAt":560},["ShallowReactive",2],{"chapter-post-project-replication-guide-09-dark-mode-and-final-checklist":3},{"chapter":4,"entry":73,"prev":355,"next":559},{"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":342,"chapterSlug":65,"cover":52,"date":56,"description":343,"draft":58,"extension":59,"lang":60,"legacySlugs":344,"meta":345,"navigation":62,"order":346,"path":347,"seo":348,"slug":349,"stem":350,"tags":351,"toc":62,"updated":56,"__hash__":354},"chapterPosts/chapter-posts/project-replication-guide/09-dark-mode-and-final-checklist.md","第 9 节：夜间模式、最终检查与上线清单",{"type":8,"value":77,"toc":335},[78,83,86,146,150,153,164,168,171,253,256,260,304,308,311,328,331],[79,80,82],"h2",{"id":81},"_91-夜间模式实现点","9.1 夜间模式实现点",[11,84,85],{},"本项目夜间模式不是“切一段类名”这么简单，而是完整主题体系：",[34,87,88,109,119,136],{},[21,89,90,94],{},[91,92,93],"code",{},"composables/useTheme.ts",[18,95,96,103,106],{},[21,97,98,99,102],{},"维护 ",[91,100,101],{},"light/dark"," 状态",[21,104,105],{},"读取系统偏好",[21,107,108],{},"localStorage 持久化",[21,110,111,114],{},[91,112,113],{},"plugins/theme.client.ts",[18,115,116],{},[21,117,118],{},"页面启动时初始化主题，减少闪屏",[21,120,121,124],{},[91,122,123],{},"assets/css/main.css",[18,125,126],{},[21,127,128,131,132,135],{},[91,129,130],{},":root"," 与 ",[91,133,134],{},":root[data-theme=\"dark\"]"," 双变量集",[21,137,138,141],{},[91,139,140],{},"components/SiteHeader.vue",[18,142,143],{},[21,144,145],{},"提供“夜间/日间”切换按钮",[79,147,149],{"id":148},"_92-为什么这种做法更稳","9.2 为什么这种做法更稳",[11,151,152],{},"优点：",[34,154,155,158,161],{},[21,156,157],{},"不绑定具体页面组件，任何页面都自动继承主题。",[21,159,160],{},"主题变量统一管理，后续改色只改一处。",[21,162,163],{},"与 giscus 评论联动，避免评论 iframe 主题不同步。",[79,165,167],{"id":166},"_93-发布前最终命令清单","9.3 发布前最终命令清单",[11,169,170],{},"每次发布前执行：",[172,173,177],"pre",{"className":174,"code":175,"language":176,"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",[91,178,179,195,204,213,224,239],{"__ignoreMap":52},[180,181,184,188,192],"span",{"class":182,"line":183},"line",1,[180,185,187],{"class":186},"sScJk","npm",[180,189,191],{"class":190},"sZZnC"," run",[180,193,194],{"class":190}," check\n",[180,196,197,199,201],{"class":182,"line":53},[180,198,187],{"class":186},[180,200,191],{"class":190},[180,202,203],{"class":190}," generate\n",[180,205,207,210],{"class":182,"line":206},3,[180,208,209],{"class":186},"git",[180,211,212],{"class":190}," status\n",[180,214,216,218,221],{"class":182,"line":215},4,[180,217,209],{"class":186},[180,219,220],{"class":190}," add",[180,222,223],{"class":190}," .\n",[180,225,227,229,232,236],{"class":182,"line":226},5,[180,228,209],{"class":186},[180,230,231],{"class":190}," commit",[180,233,235],{"class":234},"sj4cs"," -m",[180,237,238],{"class":190}," \"your message\"\n",[180,240,242,244,247,250],{"class":182,"line":241},6,[180,243,209],{"class":186},[180,245,246],{"class":190}," push",[180,248,249],{"class":190}," origin",[180,251,252],{"class":190}," main\n",[11,254,255],{},"然后去 Cloudflare Pages 看 deployment 是否成功。",[79,257,259],{"id":258},"_94-线上验收清单逐条打勾","9.4 线上验收清单（逐条打勾）",[34,261,262,268,277,283,286,289,295,298,301],{},[21,263,264,267],{},[91,265,266],{},"https://www.xuyangfly.site"," 可访问",[21,269,270,273,274],{},[91,271,272],{},"https://xuyangfly.site"," 会 301 到 ",[91,275,276],{},"www",[21,278,279,282],{},[91,280,281],{},"/admin"," 可以登录并发布",[21,284,285],{},"评论区加载正常，登录后不会空白",[21,287,288],{},"夜间模式可切换，刷新后记住状态",[21,290,291,294],{},[91,292,293],{},"/chapters"," 能看到章节目录",[21,296,297],{},"章节内子文章可访问并有上下篇",[21,299,300],{},"普通文章链路不受影响",[21,302,303],{},"RSS / Sitemap / Search Index 可访问",[79,305,307],{"id":306},"_95-你已经得到什么","9.5 你已经得到什么",[11,309,310],{},"到这一步，你拥有的是一个可以长期迭代的博客系统，而不是一次性演示页：",[34,312,313,316,319,322,325],{},[21,314,315],{},"有稳定发布路径",[21,317,318],{},"有安全边界",[21,320,321],{},"有可视化运营后台",[21,323,324],{},"有评论互动",[21,326,327],{},"有章节化知识沉淀结构",[11,329,330],{},"这正是“可持续维护”的技术项目形态。",[332,333,334],"style",{},"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":336},[337,338,339,340,341],{"id":81,"depth":53,"text":82},{"id":148,"depth":53,"text":149},{"id":166,"depth":53,"text":167},{"id":258,"depth":53,"text":259},{"id":306,"depth":53,"text":307},"Guide","完成夜间模式与主题持久化，给出发布前最终检查清单，确保你能稳定长期维护。",[],{},9,"/chapter-posts/project-replication-guide/09-dark-mode-and-final-checklist",{"title":75,"description":343},"09-dark-mode-and-final-checklist","chapter-posts/project-replication-guide/09-dark-mode-and-final-checklist",[68,352,353],"夜间模式","验收","DboPhn-EXjKFLtWP6yV2iw8FlZMQObgE7QyRDhXPHeo",{"id":356,"title":357,"body":358,"category":342,"chapterSlug":65,"cover":52,"date":56,"description":547,"draft":58,"extension":59,"lang":60,"legacySlugs":548,"meta":549,"navigation":62,"order":550,"path":551,"seo":552,"slug":553,"stem":554,"tags":555,"toc":62,"updated":56,"__hash__":558},"chapterPosts/chapter-posts/project-replication-guide/08-chapter-system-and-route-migration.md","第 8 节：章节体系（父文 + 子文 + 旧链接 301）",{"type":8,"value":359,"toc":540},[360,364,367,387,390,407,411,418,426,429,443,446,450,453,470,481,485,492,508,511,515,518,526,529,537],[79,361,363],{"id":362},"_81-章节体系是什么","8.1 章节体系是什么",[11,365,366],{},"你当前项目有 3 类内容：",[34,368,369,375,381],{},[21,370,371,372],{},"普通文章 ",[91,373,374],{},"posts",[21,376,377,378],{},"章节父文 ",[91,379,380],{},"chapters",[21,382,383,384],{},"章节子文章 ",[91,385,386],{},"chapterPosts",[11,388,389],{},"路由分别是：",[18,391,392,397,402],{},[21,393,394],{},[91,395,396],{},"/posts/:slug",[21,398,399],{},[91,400,401],{},"/chapters/:chapterSlug",[21,403,404],{},[91,405,406],{},"/chapters/:chapterSlug/:slug",[79,408,410],{"id":409},"_82-目录约束为什么重要","8.2 目录约束为什么重要",[11,412,413,414,417],{},"子文章文件路径必须匹配 frontmatter 的 ",[91,415,416],{},"chapterSlug","：",[172,419,424],{"className":420,"code":422,"language":423,"meta":52},[421],"language-text","content/chapter-posts/\u003CchapterSlug>/\u003Cpost>.md\n","text",[91,425,422],{"__ignoreMap":52},[11,427,428],{},"比如：",[18,430,431,437],{},[21,432,433,434],{},"路径：",[91,435,436],{},"content/chapter-posts/machine-learning/linear-regression.md",[21,438,439,440],{},"frontmatter：",[91,441,442],{},"chapterSlug: machine-learning",[11,444,445],{},"如果不一致，构建阶段直接报错，阻止脏数据上线。",[79,447,449],{"id":448},"_83-章节正文插目录占位符","8.3 章节正文插目录占位符",[11,451,452],{},"章节正文里插入：",[172,454,457],{"className":455,"code":456,"language":59,"meta":52,"style":52},"language-md shiki shiki-themes github-light github-dark","::chapter-children\n::\n",[91,458,459,465],{"__ignoreMap":52},[180,460,461],{"class":182,"line":183},[180,462,464],{"class":463},"sVt8B","::chapter-children\n",[180,466,467],{"class":182,"line":53},[180,468,469],{"class":463},"::\n",[11,471,472,473,476,477,480],{},"渲染时会由 ",[91,474,475],{},"components/content/ChapterChildren.vue"," 自动拉取同章节子文章并按 ",[91,478,479],{},"order"," 排序。",[79,482,484],{"id":483},"_84-旧链接迁移301","8.4 旧链接迁移（301）",[11,486,487,488,491],{},"当历史链接还是 ",[91,489,490],{},"/posts/old-slug"," 时，系统会：",[34,493,494,497,503],{},[21,495,496],{},"先查普通文章",[21,498,499,500],{},"查不到再查章节子文章的 ",[91,501,502],{},"legacySlugs",[21,504,505,506],{},"命中则 301 到新地址 ",[91,507,406],{},[11,509,510],{},"这样迁移不会让旧外链失效。",[79,512,514],{"id":513},"_85-当前策略子文章只在章节体系内出现","8.5 当前策略：子文章只在章节体系内出现",[11,516,517],{},"根据你的新要求，项目已调整为：",[18,519,520,523],{},[21,521,522],{},"子文章不进入首页、全站列表、标签页等全局流",[21,524,525],{},"子文章只通过章节页目录进入",[11,527,528],{},"这让信息结构更清晰：",[18,530,531,534],{},[21,532,533],{},"首页展示“文章/章节”",[21,535,536],{},"深度内容在章节内展开",[332,538,539],{},"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":541},[542,543,544,545,546],{"id":362,"depth":53,"text":363},{"id":409,"depth":53,"text":410},{"id":448,"depth":53,"text":449},{"id":483,"depth":53,"text":484},{"id":513,"depth":53,"text":514},"实现章节化写作、章节目录占位符、子文章路由与 legacySlugs 迁移跳转。",[],{},8,"/chapter-posts/project-replication-guide/08-chapter-system-and-route-migration",{"title":357,"description":547},"08-chapter-system-and-route-migration","chapter-posts/project-replication-guide/08-chapter-system-and-route-migration",[68,556,557],"章节体系","路由迁移","09lBKEy9m61KQ_TiC-FjEgHv0NK9QVPQjZPYyqfn_v0",null,1771232916067]