From 18b74a9d515833d4ec5734956169544e608395fc Mon Sep 17 00:00:00 2001 From: Kaxi <1042864399@qq.com> Date: Sun, 19 Jul 2026 18:49:14 +0800 Subject: [PATCH] chore: prepare open source archive --- .env.example | 3 - .gitignore | 2 + README.md | 20 +- components/blog/Giscus.vue | 14 +- components/layout/Footer.vue | 14 +- config/site.ts.example | 20 +- content/posts/hello-world/index.md | 8 +- content/posts/jira-cli-intro/index.md | 8 +- .../nuxt-tailwind-underline-fix/index.md | 4 +- docs/open-source-configuration.md | 28 + pages/index.vue | 4 +- pages/sponsor.vue | 3 +- public/sponsors/qrcode/.gitkeep | 1 + public/sponsors/qrcode/alipay.svg | 867 -------------- public/sponsors/qrcode/wechat.png | Bin 72771 -> 0 bytes public/sponsors/qrcode/wechat.svg | 1041 ----------------- 16 files changed, 94 insertions(+), 1943 deletions(-) delete mode 100644 .env.example create mode 100644 docs/open-source-configuration.md create mode 100644 public/sponsors/qrcode/.gitkeep delete mode 100644 public/sponsors/qrcode/alipay.svg delete mode 100644 public/sponsors/qrcode/wechat.png delete mode 100644 public/sponsors/qrcode/wechat.svg diff --git a/.env.example b/.env.example deleted file mode 100644 index ce4dafa..0000000 --- a/.env.example +++ /dev/null @@ -1,3 +0,0 @@ -# 备案号(必填,否则底部不显示) -NUXT_PUBLIC_ICP=蜀ICP备XXXXXXXXXX号 -NUXT_PUBLIC_PS_BEIAN=51015602001952 diff --git a/.gitignore b/.gitignore index 5cfa331..9f96b9b 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,5 @@ Thumbs.db .env .env.local config/site.ts +public/sponsors/qrcode/* +!public/sponsors/qrcode/.gitkeep diff --git a/README.md b/README.md index 0f38efc..9e7585d 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ # SuBlog -尼克的小窝 — 个人技术博客 - -🔗 官方网站:[https://nixus.top/](https://nixus.top/) +基于 Nuxt 3 的个人技术博客模板。 ## 为什么做这个 @@ -35,6 +33,9 @@ ## 快速开始 ```bash +# 创建本地站点配置(该文件不会提交到 Git) +cp config/site.ts.example config/site.ts + # 安装依赖 pnpm install @@ -60,7 +61,8 @@ pnpm new-post <文章名称> ├── components/ │ ├── layout/ # 导航栏、页脚、主题切换、3D 技术栈头像 │ └── blog/ # 文章卡片、目录、评论 -├── config/site.ts # 全站配置(改这一个文件就行) +├── config/site.ts.example # 可提交的安全配置模板 +├── config/site.ts # 本地私有站点配置(Git 忽略) ├── content/posts/ # Markdown 文章 ├── pages/ # 页面路由 ├── public/ # 静态资源 @@ -70,7 +72,11 @@ pnpm new-post <文章名称> ## 配置 -所有站点配置集中在 `config/site.ts`,站点名称、头像、社交链接、导航菜单、友链、赞助、Giscus 都在这里改,改完自动生效。首页头像使用 `components/layout/AvatarOrbit.client.vue` 渲染,技术栈图标、颜色、动画节奏在该组件内维护。 +所有个性化信息集中在本地的 `config/site.ts`:站点资料、社交链接、项目反馈地址、友链、赞助名单、收款码路径、备案信息和 Giscus 标识。该文件已被 Git 忽略,仓库只提交 `config/site.ts.example`。 + +收款二维码请放在 `public/sponsors/qrcode/` 后,再在 `config/site.ts` 填写路径;该目录同样不会提交到 Git。Giscus、收款码和备案信息留空时,对应页面内容会自动隐藏。 + +更多归档前检查项见 [开源配置说明](docs/open-source-configuration.md)。首页头像使用 `components/layout/AvatarOrbit.client.vue` 渲染,技术栈图标、颜色、动画节奏在该组件内维护。 ## 部署 @@ -80,6 +86,6 @@ pnpm generate 产物在 `.output/public` 目录,直接丢到 Nginx、Vercel、Netlify 或者 1Panel 都行。 -## 开源计划 +## 开源归档 -目前代码还不够整洁,等整理好了会考虑开源。如果你对这个项目感兴趣,欢迎先访问 [官方网站](https://nixus.top/) 看看效果。 +提交前请确认 `config/site.ts`、`.env*` 和 `public/sponsors/qrcode/` 没有被强制加入 Git;仓库内不应包含个人账号、备案信息或收款码。 diff --git a/components/blog/Giscus.vue b/components/blog/Giscus.vue index 188ea53..d8ac9cf 100644 --- a/components/blog/Giscus.vue +++ b/components/blog/Giscus.vue @@ -3,6 +3,14 @@ import { siteConfig } from '~/config/site' const colorMode = useColorMode() const container = ref() +const isEnabled = computed(() => + Boolean( + siteConfig.giscus.repo + && siteConfig.giscus.repoId + && siteConfig.giscus.category + && siteConfig.giscus.categoryId + ) +) function loadGiscus() { if (!container.value) return @@ -29,10 +37,12 @@ function loadGiscus() { } onMounted(() => { - loadGiscus() + if (isEnabled.value) loadGiscus() }) watch(() => colorMode.value, () => { + if (!isEnabled.value) return + const frame = document.querySelector('iframe.giscus-frame') if (frame?.contentWindow) { frame.contentWindow.postMessage( @@ -44,7 +54,7 @@ watch(() => colorMode.value, () => {