Skip to content

最後更新日期改用台灣正體中文格式 - #206

Merged
shyuan merged 2 commits into
mainfrom
claude/pensive-maxwell-v57ius
Oct 30, 2026
Merged

shyuan merged 2 commits into
mainfrom
claude/pensive-maxwell-v57ius

Conversation

@shyuan

@shyuan shyuan commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Closes #36(Parent: #25)

變更

src/components/ui/page-actions/PageActions.astro:

  • Intl.DateTimeFormat 的語系固定為 zh-TW,不再依 build 機器而定;正式站從「Oct 7, 2026」改為「2026年10月7日」。(不取 config.locale:schema 預設為 "en",若設定被移除會靜默退回英文。)
  • 固定 timeZone: "Asia/Taipei"。CI 在 UTC 執行,台灣時間早上 8 點前的 commit 原本會顯示成前一天。
  • 標籤「Updated」改為「最後更新」。

時間來源一致性

<time datetime>、JSON-LD dateModified、sitemap <lastmod> 原本就同一來源(frontmatter lastUpdated → git),未改動。以 /features/magicdns/ 實際 build 驗證,三者皆為 2026-10-28T06:07:25.000Z。

檢查

本機 lint、format:check、typecheck、build、lint:docs 皆通過。

不在範圍

「Copy page」「View as Markdown」按鈕文字仍為英文。

🤖 Generated with Claude Code

https://claude.ai/code/session_01YTJrz2w5XhUwczB7J6RDij

PageActions 的日期原本用 Intl.DateTimeFormat(undefined),語系與時區取決於
build 機器,正式站顯示成英文「Oct 7, 2026」。改用 config.locale(zh-TW)並
固定 Asia/Taipei 時區,顯示為「2026年10月7日」;標籤改為「最後更新」。

<time datetime>、JSON-LD dateModified 與 sitemap <lastmod> 原本就同一來源
(frontmatter lastUpdated → git),已確認三者一致。

Refs #36

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YTJrz2w5XhUwczB7J6RDij

@shyuan shyuan left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review 摘要

整體方向沒問題,沒有找到 bug。重點驗證結果:

  • 輸出格式:實際以 Node 跑 Intl.DateTimeFormat("zh-TW", { year: "numeric", month: "long", day: "numeric", timeZone: "Asia/Taipei" }),輸出為 2026年10月28日,與 PR 描述一致。
  • date-only frontmatter 不受時區釘選影響:lastUpdated: 2026-10-07 這類值解析成 UTC 零點,在 Asia/Taipei 下格式化仍是同一天。只有 git 時間戳的顯示曆日會被釘到台北時間——這正是要修的 CI(UTC)不一致,行為符合預期。
  • 型別與匯入模式:config.locale 型別為 locale?: string(node_modules/@cloudflare/nimbus-docs/dist/types.d.ts:84),?? "zh-TW" 型別合法;virtual module 的匯入方式與 BaseLayout.astro、Header.astro 等既有用法一致。<time datetime> 仍是 ISO instant,JSON-LD / sitemap 語意不變。
  • CI:Build、Code standards 目前全綠。

兩點非 bug 的提醒(inline 補充第一點):

  1. ?? "zh-TW" fallback 目前是防禦性的 dead code,且未來真的失效時行為是靜默退回英文,詳見 inline。
  2. 本檔屬 Nimbus registry component:未來 bunx @cloudflare/nimbus-docs add page-actions --overwrite 升級時會把語系釘選與「最後更新」標籤覆蓋回 upstream 版本。比照 repo 現有手改元件的做法,升級後記得重套。

「Copy page」「View as Markdown」英文按鈕 PR 已標註不在範圍,同意之後另開 issue 處理即可。

config.locale 由 schema 預設為 "en",原本的 ?? "zh-TW" 走不到;若
astro.config.ts 移除 locale,日期會靜默退回英文。本站只有 zh-TW,直接寫死。

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YTJrz2w5XhUwczB7J6RDij
@shyuan
shyuan merged commit a3a1d7a into main Oct 30, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AEO/GEO:最後更新日期改用台灣正體中文格式

2 participants