diff --git a/DEPLOY.md b/DEPLOY.md index 7e23434..cd33512 100644 --- a/DEPLOY.md +++ b/DEPLOY.md @@ -7,6 +7,49 @@ - 任意静态站点环境(Nginx/Apache/Node 静态服务、Vercel、Netlify、GitHub Pages 等) - 现代浏览器(移动/桌面) +## 一键部署 + +### Vercel + +点击下方按钮一键部署到 Vercel: + +[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/listener-He/Home) + +或者通过命令行部署: +```bash +# 安装 Vercel CLI +npm install -g vercel + +# 在项目根目录运行 +vercel +``` + +### Netlify + +点击下方按钮一键部署到 Netlify: + +[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/listener-He/Home) + +或者通过命令行部署: +```bash +# 安装 Netlify CLI +npm install -g netlify-cli + +# 在项目根目录运行 +netlify deploy +``` + +### Cloudflare Pages + +1. 登录 Cloudflare 控制台 +2. 进入 Pages 服务 +3. 选择 "Create a project" +4. 连接 GitHub 账户并选择此仓库 +5. 配置设置: + - 构建命令:`echo "No build command needed"` + - 发布目录:`.` +6. 点击 "Deploy" + ## 本地预览 - 直接在本地打开 `index.html` 与 `about.html` 即可(双击或使用任意静态服务器) @@ -58,7 +101,7 @@ server { - `SiteConfig.cacheKeys.blog`:缓存键与过期时间(毫秒) - Artalk 评论 - `SiteConfig.artalk.server` 与 `SiteConfig.artalk.site` - - `dev.isLocal`:本地或非 HTTPS 环境下自动显示“评论区已关闭”提示 + - `dev.isLocal`:本地或非 HTTPS 环境下自动显示"评论区已关闭"提示 - 主题与语言 - 主题缓存:`SiteConfig.cacheKeys.theme.key/ttlMs` - 语言存取:使用 `localStorage('lang')`,页面内可切换 CN/EN @@ -76,7 +119,7 @@ server { - 标题渐变:仅在白天保留轻微渐变,正文统一实色以提升可读性 - 评论组件(Artalk) - 桌/移端响应式:容器 `#artalk-container` 自动加 `.atk-mobile/.atk-desktop` - - 移动端折叠:评论内容默认折叠,按钮“展开/收起”交互 + - 移动端折叠:评论内容默认折叠,按钮"展开/收起"交互 ## 数据缓存与性能 @@ -86,7 +129,7 @@ server { ## 常见问题 -- 评论区在本地或非 HTTPS 环境显示“评论区已关闭” +- 评论区在本地或非 HTTPS 环境显示"评论区已关闭" - 这是预期行为;上线到 HTTPS 环境并设置 `SiteConfig.artalk` 可开启 - 夜间兴趣文本未显示渐变 - 清理浏览器缓存后重试;检查 CSS 覆盖是否被自定义样式覆盖 diff --git a/README.md b/README.md index ae4cd82..3bb8930 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,16 @@ - 🌗 **主题与语言**:一键切换 Day/Night 与 CN/EN,自动缓存记忆 - ⚡ **性能与体验**:缓存字段精简、骨架占位与淡入过渡、异步抓取避免阻塞 +## 🚀 一键部署 + +
+ +[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Flistener-He%2FHome) +[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/listener-He/Home) +[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/listener-He/Home) + +
+ ## 🖼️ 页面预览
diff --git a/_headers b/_headers new file mode 100644 index 0000000..541b629 --- /dev/null +++ b/_headers @@ -0,0 +1,6 @@ +# Security headers for Netlify +/* + X-Frame-Options: DENY + X-XSS-Protection: 1; mode=block + X-Content-Type-Options: nosniff + Referrer-Policy: strict-origin-when-cross-origin \ No newline at end of file diff --git a/_redirects b/_redirects new file mode 100644 index 0000000..ee166df --- /dev/null +++ b/_redirects @@ -0,0 +1,2 @@ +# Netlify redirects +/* /index.html 200 \ No newline at end of file diff --git a/netlify.toml b/netlify.toml new file mode 100644 index 0000000..024e15d --- /dev/null +++ b/netlify.toml @@ -0,0 +1,8 @@ +[build] + publish = "." + command = "echo 'No build command needed for static site'" + +[[redirects]] + from = "/*" + to = "/index.html" + status = 200 \ No newline at end of file diff --git a/vercel.json b/vercel.json new file mode 100644 index 0000000..245e0d4 --- /dev/null +++ b/vercel.json @@ -0,0 +1,15 @@ +{ + "version": 2, + "builds": [ + { + "src": "**/*.html", + "use": "@vercel/static" + } + ], + "routes": [ + { + "src": "/(.*)", + "dest": "/$1" + } + ] +} \ No newline at end of file