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 ---