2026/5/15
MyBlog 静态博客部署、更新与评论系统
记录 MyBlog 的 Windows 本地构建、Debian Docker 静态托管、云端入口、备案页脚、草稿模式和 Giscus 评论系统配置。
本文目录
这篇只记录 MyBlog。FRP 通用入口、Debian 服务、RustDesk 和 ntfy 日报分别放在其它文章。
结构
Windows C:\Software\MyBlog
-> npm run build
-> git push
-> Debian /opt/apps/myblog
-> docker compose up -d --build
-> 127.0.0.1:18080
-> FRP / 云 Nginx
本地构建
cd C:\Software\MyBlog
npm install
npm run dev
npm run build
当前 Windows 构建不依赖 WSL。Node、npm 和 Git 都是 Windows 本地环境。
内容目录
src/content/blog/
src/content/projects/
文章 frontmatter:
---
title: "文章标题"
date: "2026-05-15"
summary: "一句话摘要"
category: "服务器与部署"
tags: ["Nginx", "部署"]
draft: false
commentable: true
---
项目也支持草稿:
draft: true
草稿不会进入项目列表、详情页和搜索索引。
更新流程
Windows:
cd C:\Software\MyBlog
npm run build
git status
git add .
git commit -m "Update blog"
git push
Debian:
cd /opt/apps/myblog
git pull
docker compose up -d --build
docker compose ps
curl -I http://127.0.0.1:18080
Docker 托管
Compose 示例:
services:
static:
build:
context: .
dockerfile: Dockerfile.static
container_name: myblog-static
restart: unless-stopped
ports:
- "127.0.0.1:18080:80"
只监听 127.0.0.1,公网入口交给 FRP 和云 Nginx。
备案页脚
页脚预留:
ICP备案号
公安备案号
备案未完成前使用占位符,不写虚假备案信息。正式下发后替换为真实备案号,并链接到:
https://beian.miit.gov.cn/
https://beian.mps.gov.cn/#/query/webSearch
Giscus 评论
评论仓库和源码仓库分离:
private 源码仓库
public 评论仓库
Giscus App 只授权评论仓库,环境变量放 .env:
PUBLIC_GISCUS_REPO=your-name/blog-comments
PUBLIC_GISCUS_REPO_ID=your-repo-id
PUBLIC_GISCUS_CATEGORY=General
PUBLIC_GISCUS_CATEGORY_ID=your-category-id
.env 不提交。
发布前检查
npm run build
确认:
- 没有真实密码、token、完整 topic。
- 草稿页面没有生成。
- 备案号不是虚假内容。
- Giscus 只授权公开评论仓库。
dist/可以正常生成。
评论
Giscus 评论尚未配置。填写 GitHub Discussions 的仓库和分类 ID 后,这里会显示评论区。