diff --git a/CLAUDE.md b/CLAUDE.md index 5282bcd..366e6a6 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -5,8 +5,10 @@ Static site for **ByteFuture**, served from GitHub Pages (`.nojekyll`, `CNAME` Layout: - `index.html` — ByteFuture home: company intro, the hybrid-inference thesis, the two products, and a "Writings" teaser. -- `blog/` — the **Writings** section (listing + articles). Rules below. -- `posts.json` — content manifest for Writings (repo root; the site fetches it at `/posts.json`). +- `src/content/writings//.md` — the article sources (Astro content collection); the build generates `/blog/[-lang].html`. See **Authoring model — Astro** below. +- `blog/` — the **Writings** section listing pages + article assets/covers (the listing `index*.html` are still hand-maintained static files). +- `posts.json` (+ `posts-{zh,ja,ko}.json`) — the Writings manifest served at `/posts.json`, **generated at build** from the collection by `src/pages/posts*.json.ts` (the root `posts*.json` files are stale legacy, no longer served). +- `sitemap.xml` — hand-maintained (no Astro sitemap integration); new articles need manual `` entries. - `CNAME`, `.nojekyll` — GitHub Pages config. ## HARD RULE — NEVER touch analytics or ads tracking @@ -152,7 +154,20 @@ The `blog/` folder is the **ByteFuture Writings** section. It contains: - `blog/.html` — one file per published article. - cover images and article assets, also under `blog/`. -The post index is driven by `posts.json` (repo root); `blog/index.html` fetches it at `/posts.json` and renders the cards. The **HARD RULE above applies to every page under `blog/`.** +The post index is driven by `posts.json`; `blog/index.html` fetches it at `/posts.json` and renders the cards. The **HARD RULE above applies to every page under `blog/`.** + +### Authoring model — Astro (current, authoritative) + +The site is now built with **Astro** (`astro.config.mjs`, `output: 'static'`, `format: 'file'`). Articles are authored as **Markdown in a content collection**, not as hand-written HTML. This section is authoritative and supersedes the older per-file HTML instructions further down (the `cp blog/post-template.html`, "fill every `▼ EDIT ▼` marker", "copy the redirect script / GA / hreflang / view-counter verbatim into each page" steps): those describe the pre-Astro static pages and are kept only as reference for the legacy files still on disk. + +What changed, and where things live now: + +- **One Markdown file per language per article:** `src/content/writings//.md` where `` ∈ `en | zh | ja | ko`. Frontmatter fields (validated by `src/content.config.ts`): `slug`, `lang`, `title`, `summary`, `category`, `date` (`YYYY-MM-DD`), `cta` (URL, defaults to Token Station intro), `cover` (optional, repo-root-relative), `draft` (optional bool). The article body is Markdown/HTML below the frontmatter. +- **URLs are generated, unchanged:** `src/pages/blog/[...slug].astro` emits `/blog/.html` for `en` and `/blog/-.html` for the others (the `-zh/-ja/-ko` suffix is derived from `lang`, so you never hand-name files). +- **Chrome is centralized — do NOT copy it per article.** `src/layouts/WritingLayout.astro` injects, for every article automatically: the viewport meta, the i18n redirect script + `bf_lang` cookie logic, `canonical` / `og:locale` / all four `hreflang` alternates, the **GA4 tag** (`G-KQ0EX9QGK6`), the nav + language `