Skip to content

Commit 5e46e31

Browse files
committed
add readme with stack, dev steps, content workflow and design tokens
1 parent ff44793 commit 5e46e31

1 file changed

Lines changed: 163 additions & 0 deletions

File tree

README.md

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
# 蒙太奇字幕社区 · MontageSubs
2+
3+
蒙太奇字幕社区(MontageSubs)的官方网站。一个非营利、开源的字幕生态社区,连接观众、译者、开发者与影视工作者。
4+
5+
🌐 线上:<https://montagesubs.github.io>
6+
7+
---
8+
9+
## 技术栈
10+
11+
- [Astro 4](https://astro.build/) + TypeScript(静态站点生成)
12+
- [Tailwind CSS 3](https://tailwindcss.com/)(样式)
13+
- [Pagefind](https://pagefind.app/)(站内搜索,构建后注入)
14+
- 部署:GitHub Pages,通过 GitHub Actions 自动构建(见 [.github/workflows/deploy.yml](.github/workflows/deploy.yml)
15+
16+
---
17+
18+
## 本地开发
19+
20+
需要 Node 20+。
21+
22+
```bash
23+
npm install
24+
npm run dev # 启动开发服务器(默认 http://localhost:4321)
25+
npm run build # 构建到 dist/
26+
npm run preview # 预览构建产物
27+
```
28+
29+
---
30+
31+
## 目录结构
32+
33+
```
34+
src/
35+
├── pages/
36+
│ ├── zh-hans/ 简体中文页面(默认语言)
37+
│ ├── en/ 英文页面
38+
│ └── index.astro 根路径,跳转到默认语言
39+
├── components/ 全局组件(Header / Footer / Hero / ...)
40+
├── layouts/
41+
│ └── BaseLayout.astro 全站统一壳:head / Header / Footer / motion
42+
├── content/
43+
│ ├── config.ts 内容集合 schema(Zod)
44+
│ └── blog/ 博客 markdown,按语言分目录
45+
├── data/
46+
│ ├── projects.ts 字幕项目数据
47+
│ ├── tools.ts 工具数据
48+
│ └── community.ts 成员数据
49+
├── i18n/
50+
│ └── index.ts 双语 key map(扁平结构)
51+
├── styles/
52+
│ └── global.css 全局样式 + 动画原语
53+
└── env.d.ts
54+
55+
public/ 静态资源
56+
.github/workflows/deploy.yml 部署流水线
57+
astro.config.mjs Astro 配置(含 sitemap)
58+
tailwind.config.mjs 设计 tokens(颜色 / 字号 / 间距)
59+
```
60+
61+
---
62+
63+
## 添加内容
64+
65+
### 写一篇博客
66+
67+
`src/content/blog/zh-hans/`(或 `en/`)下新建 markdown 文件:
68+
69+
```markdown
70+
---
71+
title: 文章标题
72+
date: 2026-05-02
73+
lang: zh-hans
74+
author: 你的 ID
75+
has_translation: false
76+
tags: [标签1, 标签2]
77+
description: 摘要(会用于 RSS / OG)
78+
draft: false
79+
---
80+
81+
正文…
82+
```
83+
84+
文件路径自动决定 URL:`src/content/blog/zh-hans/hello-world.md``/zh-hans/learn/blog/hello-world/`
85+
86+
### 加一个项目 / 工具 / 成员
87+
88+
直接编辑对应的 TS 数据文件:
89+
90+
| 类型 | 文件 |
91+
|---|---|
92+
| 项目 | [src/data/projects.ts](src/data/projects.ts) |
93+
| 工具 | [src/data/tools.ts](src/data/tools.ts) |
94+
| 成员 | [src/data/community.ts](src/data/community.ts) |
95+
96+
每个文件顶部有 TS 接口定义,照着加一条记录就行。
97+
98+
### 改文案 / 加翻译
99+
100+
所有页面文案集中在 [src/i18n/index.ts](src/i18n/index.ts),是一个扁平的双语 key map:
101+
102+
```ts
103+
'home.hero.line1': '让字幕', // 中文
104+
// 对应位置
105+
'home.hero.line1': 'Subtitles', // 英文
106+
```
107+
108+
新增 key 时两边都要补,否则缺失语种会 fallback 到中文。
109+
110+
---
111+
112+
## 设计 Tokens
113+
114+
集中在 [tailwind.config.mjs](tailwind.config.mjs)
115+
116+
**颜色**
117+
118+
| Token || 用途 |
119+
|---|---|---|
120+
| `ink` | `#0a0a0a` | 主背景(近黑) |
121+
| `bone` | `#f5f1e8` | 主文字(暖白) |
122+
| `bone-dim` | `#cfc9bb` | 次要文字 |
123+
| `bone-mute` | `#8a857a` | 标注 / 元数据 |
124+
| `signal-yellow` | `#FACC15` | 品牌主色 |
125+
| `live` | `#22c55e` | 在线状态点 |
126+
127+
**字号**
128+
129+
| Token | 用途 |
130+
|---|---|
131+
| `text-display` | 首屏 / 二级页 hero h1 |
132+
| `text-mega` | section h2 |
133+
134+
**字体**:纯系统字体栈,**不引入任何外部字体文件**(PingFang SC / SF Pro / SF Mono)。
135+
136+
---
137+
138+
## 部署
139+
140+
推送到 `main` 即触发 GitHub Actions 构建并部署到 GitHub Pages。流程:
141+
142+
1. `npm ci`
143+
2. `npm run build`
144+
3. `npx pagefind --site dist`(生成搜索索引)
145+
4. 上传 `dist/` 到 Pages
146+
147+
首次部署前需要在仓库 Settings → Pages 把 Source 设为 **GitHub Actions**
148+
149+
---
150+
151+
## 协议
152+
153+
- 内容(博客文章 / 文档 / 翻译):[CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/)
154+
- 代码:[MIT](https://opensource.org/licenses/MIT)
155+
156+
---
157+
158+
## 社区与联系
159+
160+
- Telegram:<https://t.me/MontageSubs>
161+
- Discord:<https://discord.gg/montagesubs>
162+
- GitHub Discussions:<https://github.com/MontageSubs/community/discussions>
163+
- 邮件:dev@montagesubs.org(技术合作)/ press@montagesubs.org(媒体)

0 commit comments

Comments
 (0)