我们调整一下思路,不用找文件了,直接给你一个零配置、零路径问题、全站生效的方案:


✅ 终极方案:直接在 Quartz 配置里添加全局页脚

不用修改复杂的 footer.html,我们直接在网站的全局配置里添加备案信息,所有页面都会自动显示。

  1. 打开你的 Quartz 根目录里的 cfg.ts 文件
  2. 找到 theme 配置,在里面加上 footer 字段:
// cfg.ts
theme: {
  // ... 你原来的其他配置
  footer: `
    <p>Created with <a href="https://quartz.jzhao.xyz/">Quartz v4.5.2</a> © 2026</p>
    <div style="margin-top:10px; font-size:14px; display:flex; gap:15px; flex-wrap:wrap; align-items:center; justify-content:center;">
      <a href="https://beian.miit.gov.cn/" target="_blank" style="color:inherit; text-decoration:none;">
        <img src="https://img.shields.io/badge/-ICP-blue?style=flat-square" style="height:16px; vertical-align:middle; margin-right:4px;">
        鲁ICP备2026020734号-1
      </a>
      <a href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=32011502013875" target="_blank" style="color:inherit; text-decoration:none;">
        <img src="https://img.shields.io/badge/-公安-red?style=flat-square" style="height:16px; vertical-align:middle; margin-right:4px;">
        苏公网安备32011502013875号
      </a>
    </div>
    <ul style="list-style:none; padding:0; display:flex; gap:1rem; justify-content:center; margin-top:10px;">
      <li><a href="https://github.com/jackyzha0/quartz" style="color:inherit;">GitHub</a></li>
      <li><a href="https://discord.gg/cRFFHYye7t" style="color:inherit;">Discord Community</a></li>
    </ul>
  `,
}

🚀 操作步骤

  1. 保存 cfg.ts 文件
  2. 在项目根目录运行命令:
    npx quartz build
  3. 部署生成后的 public 文件夹

✨ 这个方案的好处

  • 不用找任何文件夹,不用修改 components 里的文件,只改这一个配置文件就行
  • 配置里的 HTML 会被直接渲染到所有页面的页脚,全站自动生效
  • 图标用的是稳定的 CDN 地址,不会再出现加载失败的问题
  • 已经加好了基础样式,备案号和图标会居中显示,和网站风格适配

这样修改后,你网站的每一个页面底部都会自动带上双备案信息,完全满足合规要求。

需要我帮你核对一下你的 cfg.ts 文件里 theme 部分的配置,直接帮你写好完整的配置代码吗?

相关链接

ICP备案和公安备案 | 1.目的 | 2.步骤