Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ concurrency:

jobs:
check:
name: Type-check and build
name: Lint, test, type-check and build
runs-on: ubuntu-latest
env:
# Build against the committed fixtures rather than the private content
Expand All @@ -29,6 +29,12 @@ jobs:

- run: npm ci

# Lint and unit tests run before the content is wired up: neither needs
# the vault, and both fail in seconds, so a formatting or logic error does
# not wait behind a full Astro build to be reported.
- run: npm run lint
- run: npm test

# `astro check` needs the generated collection types, which `astro sync`
# produces; the prebuild hook wires the fixtures into src/content/ first.
- run: npm run setup:content
Expand Down
14 changes: 0 additions & 14 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,3 @@ jobs:
manifest-file: .release-please-manifest.json
# GitHub token (automatically provided by GitHub Actions)
token: ${{ secrets.GITHUB_TOKEN }}

# Optional: Automatically merge the release PR when it's ready
# Uncomment the following job if you want auto-merge
# auto-merge:
# needs: release-please
# if: needs.release-please.outputs.release_created == 'true'
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: peter-evans/enable-pull-request-automerge@v3
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
# pull-request-number: ${{ needs.release-please.outputs.pr }}

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ dist/
src/content/people
src/content/projects
src/content/library
src/content/publications
# Note: public/ should NOT be ignored - it contains static assets like background.jpg
# Only ignore generated content in public/attachments/ (synced from content repo)
public/attachments/
Expand Down
19 changes: 19 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Build output and generated indexes
dist/
.astro/
public/pagefind/

# Vault content: a separate repository, symlinked in by scripts/setup-content.mjs.
# Reformatting it here would either fail (broken symlink) or rewrite files this
# repo does not own.
.content/
src/content/people/
src/content/projects/
src/content/library/

# Fixtures are deliberate regression inputs — several encode exact whitespace
# and hostile markup that a formatter would helpfully "fix".
fixtures/

package-lock.json
CHANGELOG.md
11 changes: 11 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"singleQuote": true,
"printWidth": 100,
"plugins": ["prettier-plugin-astro"],
"overrides": [
{
"files": "*.astro",
"options": { "parser": "astro" }
}
]
}
37 changes: 23 additions & 14 deletions FRONTEND_GUIDELINES.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,16 @@

内容仓库会在 dev/CI 被放到 `.content/`(软链或 clone)。后端会按如下规则映射到 collections:

- `site`: `.content/Team-Guidebook/site.md`(单例;站点身份 + 「关于」页正文)
- `news`: `.content/Team-Guidebook/档案馆/YYYY-MM-DD.md`(Obsidian 日记,按 bullet 抽取;仅 `publish: true` 才公开)
- `people`: `.content/Team-Guidebook/通讯录/*.md`
- `projects`: `.content/Team-Guidebook/图书馆/项目/*.md`
- `library`: `.content/Team-Guidebook/图书馆/**/*.md`
- `blog`:**尚未实现**(`src/content.config.ts` 只定义了 people / projects / news / library / publications)。阶段 2 才做独立栏目:`.content/Team-Guidebook/公告板/博客/*.md`
- `research`: `.content/Team-Guidebook/图书馆/研究/*.md`
- `resources`: `.content/Team-Guidebook/图书馆/资源/*.md`
- `publications`: `.content/Team-Guidebook/图书馆/文献/*.bib`,并合并 `文献/精选/<bib_key>.md` sidecar
- `library`: `.content/Team-Guidebook/图书馆/**/*.md`(排除上述子目录)
- `translations`: vault 内所有 `**/*.en.md`(正文覆盖层,见 §4.3)
- `blog`:**尚未实现**

## 2. 数据接口 (Content Collections API)

Expand All @@ -36,8 +41,10 @@

| 集合名称 (Collection) | 用途 | 对应路由示例 | 关键字段 (Props) |
| :--- | :--- | :--- | :--- |
| `people` | 实验室成员 | `/[lang]/people/[slug]` | `name`, `role`, `avatar`, `email`, `interests` |
| `projects` | 项目展示 | `/[lang]/projects/[slug]` | `title`, `people` (关联人员ID), `start_date`, `repo` |
| `people` | 实验室成员 | `/[lang]/people/[slug]` | `name`, `role`(受控词表), `status`, `avatar`, `email`, `interests` |
| `projects` | 项目展示 | `/[lang]/projects/[slug]` | `title`, `summary`, `people` (关联人员ID), `start_date`, `repo`, `featured` |
| `research` | 研究方向 | `/[lang]/research/[slug]` | `title`, `summary`, `order`, 交叉引用 people/projects/publications |
| `resources` | 数据与工具 | `/[lang]/resources` | `title`, `type`, `url`, `doi`, `license` |
| `news` | 动态/新闻 | `/[lang]/news` (列表) | `date`, `tags`, `related_people`, `body` (HTML) |
| `publications` | 论文发表 | `/[lang]/publications` | (特殊) 由 BibTeX 解析的 JSON 对象列表 |
| `library` | 知识库/Wiki | `/[lang]/library/[...slug]` | 标准 Markdown 内容 |
Expand Down Expand Up @@ -120,19 +127,21 @@ interface NewsItem {
* **后端承诺**: 默认解析到 Library:`<a href="/[lang]/library/..." class="internal-link">`。
* **前端任务**: 为 `.internal-link` 类添加样式 (例如虚线下划线或特定颜色),以区分普通外部链接。

## 4.3 i18n 范围(现状)
## 4.3 i18n(现状)

**实现现状**(与早期计划不同,此处描述的是代码实际行为):
**已实现**(此处描述的是代码实际行为):

- `/` 重定向到 `/en/`,默认语言只在 `astro.config.mjs` 一处定义。
- `/zh` 与 `/en` 两棵路由树**渲染同一份中文内容**——没有任何按语言过滤的逻辑,
尽管 `src/content.config.ts` 的 library schema 已声明了 `lang` 字段。
差异仅限于 URL 前缀、`<html lang>` 与少量 UI 字符串。
- `BaseLayout` 已输出 `canonical` 与 `hreflang`,因此重复内容对 SEO 无害;
但这不等于 `/en` 是真正的英文站。
- `/` 重定向到 `/en/`,默认语言只在 `astro.config.mjs` 一处定义(`DEFAULT_LOCALE`)。
- 中文是基准语言,英文是可选覆盖层。两种机制:
- **短字段**在同一文件内成对:`name` / `name_en`、`title` / `title_en`。
- **长正文**用兄弟文件 `<name>.en.md`,由 `translations` 集合承载。
- 缺英文时回退中文,并渲染 `ui.i18n.fallbackNotice` 提示条——**不会出现空页**。
- 唯一的取值入口是 `src/utils/localized.ts` 的 `pickLocalized` / `pickLocalizedList`
与 `resolveLocalized` / `translationIndex`。**页面里不要再写
`lang === 'zh' ? … : …` 去取内容字段**——那正是这个模块要消灭的东西。
- `BaseLayout` 输出 `canonical` 与 `hreflang`;现在它们描述的是真实译文关系。

**待决策**:是按 `data.lang` 过滤(`/en` 只渲染英文条目、其余走空态),
还是暂时下线 `/en`。在此之前,任何"英文内容"的假设都不成立。
**尚未覆盖**:News(日记 bullet)只渲染中文原文,英文路由显示同一条。

## 5. 开发建议

Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@

Astro + TypeScript + Tailwind static site for the lab. Content is Obsidian-driven with direct mapping from the `Team-Guidebook/` vault.

Dual-language routes `/zh` and `/en` are scaffolded, and `/` redirects to **`/en/`** — the default locale is set in exactly one place, `astro.config.mjs`. Note that both trees currently render the same Chinese content; filtering by `data.lang` is not implemented yet.
Dual-language routes `/zh` and `/en` share one `src/pages/[lang]/` tree, and `/` redirects to **`/en/`** — the default locale is set in exactly one place, `astro.config.mjs`.

Chinese is the base language; English is an optional overlay. Short fields pair
in one file (`name` / `name_en`), long prose goes in a `<name>.en.md` sibling
picked up by the `translations` collection. A page with no English falls back to
the Chinese **and says so**. See [Content Maintenance](./docs/CONTENT_MAINTENANCE.md#双语).

## Content Sync Strategy

Expand Down
Loading
Loading