From 4637948b22d90e04126da1986f3a46305642d3e4 Mon Sep 17 00:00:00 2001 From: Kaxi <1042864399@qq.com> Date: Mon, 1 Jun 2026 00:35:13 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=AE=8C=E5=96=84=20new-post=20?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=E6=A8=A1=E6=9D=BF=EF=BC=8C=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=20CLAUDE.md=20=E6=96=B0=E5=A2=9E=E6=96=87=E7=AB=A0=E6=B5=81?= =?UTF-8?q?=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- CLAUDE.md | 6 ++++++ scripts/new-post.js | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CLAUDE.md b/CLAUDE.md index 7231af9..8f6f57a 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -28,6 +28,12 @@ pnpm new-post # 创建新文章(自动生成 frontmatter 和图片目 - 构建时 `nuxt.config.ts` 中的 hook 自动将 `content/posts//img/` 复制到产物目录 - 开发模式图片通过 `server/routes/posts/[slug]/img/[...file].ts` 读取源文件 +### 新增文章流程 +1. 执行 `pnpm new-post ` 自动生成目录结构和模板 +2. 脚本会创建 `content/posts//index.md`(含 frontmatter 模板)和 `content/posts//img/` 目录 +3. 填写 frontmatter(`description`、`tags` 必填),编写正文 +4. 封面图放在 `img/` 目录下,路径为 `/posts//img/cover.jpg` + ### 页面路由 - `pages/index.vue` — 首页(社交卡片、导航、网易云热评、不蒜子计数) - `pages/posts/index.vue` — 文章列表(搜索、标签过滤、分页) diff --git a/scripts/new-post.js b/scripts/new-post.js index 891fbfb..6ad786e 100644 --- a/scripts/new-post.js +++ b/scripts/new-post.js @@ -9,7 +9,7 @@ if (!name) { } const now = new Date() -const date = now.toISOString().slice(0, 10) +const date = now.toISOString().slice(0, 19) const dir = resolve('content/posts', name) const file = join(dir, 'index.md') @@ -28,6 +28,7 @@ title: ${name} published: ${date} description: image: /posts/${name}/img/cover.jpg +tags: [] draft: false ---