[{"data":1,"prerenderedAt":427},["ShallowReactive",2],{"insight-nuxt-pagefind":3,"insight-related-nuxt-pagefind":159},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":7,"slug":9,"date":10,"duration":11,"category":12,"author":13,"tags":14,"body":19,"_type":153,"_id":154,"_source":155,"_file":156,"_stem":157,"_extension":158},"\u002Finsights\u002F15-nuxt-pagefind","insights",false,"","Nuxt 3 静态化 + Pagefind：内容站的工程实践","nuxt-pagefind","2026-02-28",8,"技术实践","浩途技术团队",[15,16,17,18],"Nuxt 3","Pagefind","SSG","静态站",{"type":20,"children":21,"toc":146},"root",[22,30,44,48,54,89,92,98,117,126,129,134],{"type":23,"tag":24,"props":25,"children":27},"element","h2",{"id":26},"引子",[28],{"type":29,"value":26},"text",{"type":23,"tag":31,"props":32,"children":33},"p",{},[34,36,42],{"type":29,"value":35},"浩途官网（haotunet.com）是一个纯静态站——不需要后端、不依赖 CDN 智能化、单机\nnginx 就能服务全国。但又需要站内搜索。",{"type":23,"tag":37,"props":38,"children":39},"strong",{},[40],{"type":29,"value":41},"Nuxt 3 + Pagefind",{"type":29,"value":43}," 的组合让这两件事\n零摩擦共存。",{"type":23,"tag":45,"props":46,"children":47},"hr",{},[],{"type":23,"tag":24,"props":49,"children":51},{"id":50},"工程选择的三个-trade-off",[52],{"type":29,"value":53},"工程选择的三个 trade-off",{"type":23,"tag":55,"props":56,"children":57},"ol",{},[58,69,79],{"type":23,"tag":59,"props":60,"children":61},"li",{},[62,67],{"type":23,"tag":37,"props":63,"children":64},{},[65],{"type":29,"value":66},"SSG vs SSR",{"type":29,"value":68},"：选 SSG（静态化），换更简单的部署",{"type":23,"tag":59,"props":70,"children":71},{},[72,77],{"type":23,"tag":37,"props":73,"children":74},{},[75],{"type":29,"value":76},"客户端搜索 vs 服务端搜索",{"type":29,"value":78},"：选客户端（Pagefind），不需要 ES",{"type":23,"tag":59,"props":80,"children":81},{},[82,87],{"type":23,"tag":37,"props":83,"children":84},{},[85],{"type":29,"value":86},"站内全文 vs 内容片段",{"type":29,"value":88},"：构建时索引，下载体积可控",{"type":23,"tag":45,"props":90,"children":91},{},[],{"type":23,"tag":24,"props":93,"children":95},{"id":94},"关键工程点占位",[96],{"type":29,"value":97},"关键工程点（占位）",{"type":23,"tag":99,"props":100,"children":101},"ul",{},[102,107,112],{"type":23,"tag":59,"props":103,"children":104},{},[105],{"type":29,"value":106},"Pagefind 的索引时机：build 阶段而非 dev",{"type":23,"tag":59,"props":108,"children":109},{},[110],{"type":29,"value":111},"索引体积：50 篇内容大约 500KB，懒加载即可",{"type":23,"tag":59,"props":113,"children":114},{},[115],{"type":29,"value":116},"与 Cmd+K 弹窗的集成",{"type":23,"tag":118,"props":119,"children":120},"blockquote",{},[121],{"type":23,"tag":31,"props":122,"children":123},{},[124],{"type":29,"value":125},"（具体配置文件、索引体积控制、UX 细节后续展开）",{"type":23,"tag":45,"props":127,"children":128},{},[],{"type":23,"tag":24,"props":130,"children":132},{"id":131},"写在最后",[133],{"type":29,"value":131},{"type":23,"tag":31,"props":135,"children":136},{},[137,139,144],{"type":29,"value":138},"不是所有内容站都需要重型架构。",{"type":23,"tag":37,"props":140,"children":141},{},[142],{"type":29,"value":143},"对内容站来说，越简单越长寿",{"type":29,"value":145},"——这是浩途自己用一年\n跑下来的体会。",{"title":7,"searchDepth":147,"depth":147,"links":148},2,[149,150,151,152],{"id":26,"depth":147,"text":26},{"id":50,"depth":147,"text":53},{"id":94,"depth":147,"text":97},{"id":131,"depth":147,"text":131},"markdown","content:insights:15-nuxt-pagefind.md","content","insights\u002F15-nuxt-pagefind.md","insights\u002F15-nuxt-pagefind","md",[160,288],{"_path":161,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":162,"description":7,"slug":163,"date":164,"duration":165,"category":12,"author":13,"tags":166,"body":170,"_type":153,"_id":285,"_source":155,"_file":286,"_stem":287,"_extension":158},"\u002Finsights\u002F14-django-tech-debt","长期可维护：6 年 Django 项目的技术债治理","django-tech-debt","2026-04-02",11,[167,168,169],"Django","技术债","长期维护",{"type":20,"children":171,"toc":279},[172,176,188,191,197,202,220,225,228,234,252,260,263,267],{"type":23,"tag":24,"props":173,"children":174},{"id":26},[175],{"type":29,"value":26},{"type":23,"tag":31,"props":177,"children":178},{},[179,181,186],{"type":29,"value":180},"祁门政务大屏从 2018 年上线至今 6 年，仍在持续迭代。最初的 Django 项目按\"今天\n看明天就过时\"的标准看，技术债理论上爆炸了——但它没有。这篇文章写浩途如何",{"type":23,"tag":37,"props":182,"children":183},{},[184],{"type":29,"value":185},"边\n走边换",{"type":29,"value":187},"地治理技术债。",{"type":23,"tag":45,"props":189,"children":190},{},[],{"type":23,"tag":24,"props":192,"children":194},{"id":193},"原则不重构重组装",[195],{"type":29,"value":196},"原则：不重构，重组装",{"type":23,"tag":31,"props":198,"children":199},{},[200],{"type":29,"value":201},"每次新需求来时优先做三件事：",{"type":23,"tag":55,"props":203,"children":204},{},[205,210,215],{"type":23,"tag":59,"props":206,"children":207},{},[208],{"type":29,"value":209},"把要改的模块的依赖收敛清楚",{"type":23,"tag":59,"props":211,"children":212},{},[213],{"type":29,"value":214},"把\"不再用的\"代码先标记 deprecated 而不删除",{"type":23,"tag":59,"props":216,"children":217},{},[218],{"type":29,"value":219},"在 deprecated 周围逐步建立新模块",{"type":23,"tag":31,"props":221,"children":222},{},[223],{"type":29,"value":224},"3 年下来旧代码消化掉一大半，期间项目从未停止迭代。",{"type":23,"tag":45,"props":226,"children":227},{},[],{"type":23,"tag":24,"props":229,"children":231},{"id":230},"三类常见债的处理占位",[232],{"type":29,"value":233},"三类常见债的处理（占位）",{"type":23,"tag":99,"props":235,"children":236},{},[237,242,247],{"type":23,"tag":59,"props":238,"children":239},{},[240],{"type":29,"value":241},"数据库 schema 历史遗留",{"type":23,"tag":59,"props":243,"children":244},{},[245],{"type":29,"value":246},"第三方 SDK 升级断点",{"type":23,"tag":59,"props":248,"children":249},{},[250],{"type":29,"value":251},"早期接口设计的硬编码",{"type":23,"tag":118,"props":253,"children":254},{},[255],{"type":23,"tag":31,"props":256,"children":257},{},[258],{"type":29,"value":259},"（每类的具体处理 pattern 后续展开）",{"type":23,"tag":45,"props":261,"children":262},{},[],{"type":23,"tag":24,"props":264,"children":265},{"id":131},[266],{"type":29,"value":131},{"type":23,"tag":31,"props":268,"children":269},{},[270,272,277],{"type":29,"value":271},"技术债治理不是项目，是",{"type":23,"tag":37,"props":273,"children":274},{},[275],{"type":29,"value":276},"日常",{"type":29,"value":278},"。把它当作每周做的事，而不是每年做的事——这是长期项目\n能活下来的关键。",{"title":7,"searchDepth":147,"depth":147,"links":280},[281,282,283,284],{"id":26,"depth":147,"text":26},{"id":193,"depth":147,"text":196},{"id":230,"depth":147,"text":233},{"id":131,"depth":147,"text":131},"content:insights:14-django-tech-debt.md","insights\u002F14-django-tech-debt.md","insights\u002F14-django-tech-debt",{"_path":289,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":290,"description":7,"slug":291,"date":292,"duration":293,"category":12,"author":13,"tags":294,"body":299,"_type":153,"_id":424,"_source":155,"_file":425,"_stem":426,"_extension":158},"\u002Finsights\u002F16-mysql-to-postgres","数据库迁移：100+ 表的 MySQL 项目迁到 PostgreSQL","mysql-to-postgres","2025-10-15",14,[295,296,297,298],"数据库","迁移","MySQL","PostgreSQL",{"type":20,"children":300,"toc":418},[301,305,317,320,326,354,357,363,391,399,402,406],{"type":23,"tag":24,"props":302,"children":303},{"id":26},[304],{"type":29,"value":26},{"type":23,"tag":31,"props":306,"children":307},{},[308,310,315],{"type":29,"value":309},"某客户的核心业务系统跑在 MySQL 上 5 年了，因合规要求需要迁到 PostgreSQL，且业务",{"type":23,"tag":37,"props":311,"children":312},{},[313],{"type":29,"value":314},"不能\n停超过 2 小时",{"type":29,"value":316},"。这次迁移是浩途近年最复杂的一次基础设施变更，复盘写下来。",{"type":23,"tag":45,"props":318,"children":319},{},[],{"type":23,"tag":24,"props":321,"children":323},{"id":322},"整体策略双写-灰度切流",[324],{"type":29,"value":325},"整体策略：双写 + 灰度切流",{"type":23,"tag":55,"props":327,"children":328},{},[329,334,339,344,349],{"type":23,"tag":59,"props":330,"children":331},{},[332],{"type":29,"value":333},"先在生产环境双写（MySQL 主、PostgreSQL 影子）",{"type":23,"tag":59,"props":335,"children":336},{},[337],{"type":29,"value":338},"影子库跑业务回归 + 数据校对",{"type":23,"tag":59,"props":340,"children":341},{},[342],{"type":29,"value":343},"只读流量先切到 PostgreSQL 灰度",{"type":23,"tag":59,"props":345,"children":346},{},[347],{"type":29,"value":348},"写流量按业务模块逐步切换",{"type":23,"tag":59,"props":350,"children":351},{},[352],{"type":29,"value":353},"MySQL 降级为只读 backup，30 天后下线",{"type":23,"tag":45,"props":355,"children":356},{},[],{"type":23,"tag":24,"props":358,"children":360},{"id":359},"踩过的坑占位",[361],{"type":29,"value":362},"踩过的坑（占位）",{"type":23,"tag":99,"props":364,"children":365},{},[366,371,376,381,386],{"type":23,"tag":59,"props":367,"children":368},{},[369],{"type":29,"value":370},"字符集 \u002F 时区差异",{"type":23,"tag":59,"props":372,"children":373},{},[374],{"type":29,"value":375},"自增 ID 的连续性",{"type":23,"tag":59,"props":377,"children":378},{},[379],{"type":29,"value":380},"全文索引语义差异",{"type":23,"tag":59,"props":382,"children":383},{},[384],{"type":29,"value":385},"触发器与存储过程的等价改写",{"type":23,"tag":59,"props":387,"children":388},{},[389],{"type":29,"value":390},"应用层 ORM 的 SQL 兼容",{"type":23,"tag":118,"props":392,"children":393},{},[394],{"type":23,"tag":31,"props":395,"children":396},{},[397],{"type":29,"value":398},"（每个坑的具体方案与回归脚本后续展开）",{"type":23,"tag":45,"props":400,"children":401},{},[],{"type":23,"tag":24,"props":403,"children":404},{"id":131},[405],{"type":29,"value":131},{"type":23,"tag":31,"props":407,"children":408},{},[409,411,416],{"type":29,"value":410},"数据库迁移没有\"标准方案\"，只有\"对你的业务最小风险的路径\"。",{"type":23,"tag":37,"props":412,"children":413},{},[414],{"type":29,"value":415},"预演 2-3 次比文档读 10\n份更有用",{"type":29,"value":417},"——这是浩途技术团队的硬经验。",{"title":7,"searchDepth":147,"depth":147,"links":419},[420,421,422,423],{"id":26,"depth":147,"text":26},{"id":322,"depth":147,"text":325},{"id":359,"depth":147,"text":362},{"id":131,"depth":147,"text":131},"content:insights:16-mysql-to-postgres.md","insights\u002F16-mysql-to-postgres.md","insights\u002F16-mysql-to-postgres",1780542368368]