From b50eddf2bb2602a375f0f8b62a681b6398ca4695 Mon Sep 17 00:00:00 2001 From: wait4xx Date: Sat, 24 Oct 2026 23:09:45 +0800 Subject: [PATCH] =?UTF-8?q?feat(layout):=20=E5=9F=BA=E7=A1=80=E5=B8=83?= =?UTF-8?q?=E5=B1=80/=E5=AF=BC=E8=88=AA/=E9=A1=B5=E8=84=9A/=E6=98=8E?= =?UTF-8?q?=E6=9A=97=E4=B8=8D=E9=97=AA=E7=83=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - BaseLayout:字体三轨统持、viewport-fit=cover、theme-color 双套、skip-link - Header:≤4 项导航纪律 + sticky 毛玻璃 + aria-current;搜索 icon 占位待 T8 - Footer:ICP 备案链接(法定保留)+ built-from 具名槽位待 T7 - ThemeScript:head 内联先于首帧,手选 > 系统偏好,防白闪 验证: pnpm astro build exit 0;dist/index.html 含 ICP 文案与跳到正文链 Spec: 2026-10-24_add-blog-skeleton Co-authored-by: GLM-5.3 --- src/components/Footer.astro | 39 +++++++++++++++ src/components/Header.astro | 84 ++++++++++++++++++++++++++++++++ src/components/ThemeScript.astro | 14 ++++++ src/layouts/BaseLayout.astro | 44 +++++++++++++++++ src/pages/index.astro | 17 ++----- 5 files changed, 185 insertions(+), 13 deletions(-) create mode 100644 src/components/Footer.astro create mode 100644 src/components/Header.astro create mode 100644 src/components/ThemeScript.astro create mode 100644 src/layouts/BaseLayout.astro diff --git a/src/components/Footer.astro b/src/components/Footer.astro new file mode 100644 index 0000000..9b53d13 --- /dev/null +++ b/src/components/Footer.astro @@ -0,0 +1,39 @@ +--- +// 页脚:版权 + ICP 备案(法定保留)+ 构建透明槽位(T7 built-from 填充) +--- + + + + diff --git a/src/components/Header.astro b/src/components/Header.astro new file mode 100644 index 0000000..d1c17a9 --- /dev/null +++ b/src/components/Header.astro @@ -0,0 +1,84 @@ +--- +// 顶部导航:≤4 项纪律(防 higan 十项复发);当前页 aria-current +const nav = [ + { href: '/archives/', label: '文章' }, + { href: '/gallery/', label: '图库' }, + { href: '/about/', label: '关于' }, +]; +const path = Astro.url.pathname; +const isCurrent = (href: string) => + path === href || path === href.replace(/\/$/, '') || path.startsWith(href); +--- + + + + diff --git a/src/components/ThemeScript.astro b/src/components/ThemeScript.astro new file mode 100644 index 0000000..e3ab50b --- /dev/null +++ b/src/components/ThemeScript.astro @@ -0,0 +1,14 @@ +--- +// 明暗不闪烁脚本: 内联、先于首帧。 +// 优先级:用户手选(localStorage) > 系统偏好;切换按钮(T7 键盘/组件)写同一 key。 +--- + + diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro new file mode 100644 index 0000000..b89774e --- /dev/null +++ b/src/layouts/BaseLayout.astro @@ -0,0 +1,44 @@ +--- +// 基础布局:字体/样式统一在此持有(页面不再各自引包) +// 明暗不闪烁:ThemeScript 必须在 内联先于首帧执行 +import 'lxgw-wenkai-screen-webfont/lxgwwenkaiscreen.css'; +import '@fontsource/noto-sans-sc/400.css'; +import '@fontsource/noto-sans-sc/500.css'; +import '@fontsource/noto-sans-sc/700.css'; +import '@fontsource/jetbrains-mono/400.css'; +import '@fontsource/jetbrains-mono/700.css'; +import '../styles/global.css'; +import Header from '../components/Header.astro'; +import Footer from '../components/Footer.astro'; +import ThemeScript from '../components/ThemeScript.astro'; + +interface Props { + title: string; + description?: string; + /** 正文轨:reading 书评纸墨 / tech 技术(body 级字体氛围) */ + track?: 'reading' | 'tech'; +} +const { title, description = 'wait4x 的博客:阅读 · 技术 · 摄影', track = 'tech' } = Astro.props; +--- + + + + + + + + + + + {title} + + + + +
+
+ +
+