chore: 完善 new-post 脚本模板,更新 CLAUDE.md 新增文章流程
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -28,6 +28,12 @@ pnpm new-post <name> # 创建新文章(自动生成 frontmatter 和图片目
|
||||
- 构建时 `nuxt.config.ts` 中的 hook 自动将 `content/posts/<slug>/img/` 复制到产物目录
|
||||
- 开发模式图片通过 `server/routes/posts/[slug]/img/[...file].ts` 读取源文件
|
||||
|
||||
### 新增文章流程
|
||||
1. 执行 `pnpm new-post <slug>` 自动生成目录结构和模板
|
||||
2. 脚本会创建 `content/posts/<slug>/index.md`(含 frontmatter 模板)和 `content/posts/<slug>/img/` 目录
|
||||
3. 填写 frontmatter(`description`、`tags` 必填),编写正文
|
||||
4. 封面图放在 `img/` 目录下,路径为 `/posts/<slug>/img/cover.jpg`
|
||||
|
||||
### 页面路由
|
||||
- `pages/index.vue` — 首页(社交卡片、导航、网易云热评、不蒜子计数)
|
||||
- `pages/posts/index.vue` — 文章列表(搜索、标签过滤、分页)
|
||||
|
||||
+2
-1
@@ -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
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user