From 4694428614f2c2bbb75725403789f6c145939535 Mon Sep 17 00:00:00 2001 From: wait4xx Date: Sun, 25 Oct 2026 00:13:29 +0800 Subject: [PATCH] =?UTF-8?q?feat(search):=20=E7=AB=99=E5=86=85=E6=90=9C?= =?UTF-8?q?=E7=B4=A2/RSS/sitemap/Artalk=20=E6=87=92=E6=8C=82=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - astro-pagefind:构建期索引;SearchDialog 首开懒加载 + 200ms 防抖, 入口=Header 钮 + 键盘 /(P0 键位集补全) - @astrojs/rss:posts 全量(draft 排除),双语分流留 Phase 3 - @astrojs/sitemap:sitemap-index 产出 - ArtalkComments:IntersectionObserver 进入视口才拉 Artalk.js, pageKey=/archives/{slug}/(中英共键,评论不分裂) 验证: pnpm astro build exit 0;dist/pagefind 目录 + rss.xml + sitemap-index.xml 三件断言过 Spec: 2026-10-24_add-blog-skeleton Co-authored-by: GLM-5.3 --- .../2026-10-24_add-blog-skeleton/tasks.md | 2 +- astro.config.mjs | 3 + package.json | 3 + pnpm-lock.yaml | 283 +++++++++++++++++- src/components/ArtalkComments.astro | 43 +++ src/components/SearchDialog.astro | 101 +++++++ src/layouts/BaseLayout.astro | 2 + src/pages/archives/[...slug].astro | 4 +- src/pages/rss.xml.ts | 21 ++ 9 files changed, 449 insertions(+), 13 deletions(-) create mode 100644 src/components/ArtalkComments.astro create mode 100644 src/components/SearchDialog.astro create mode 100644 src/pages/rss.xml.ts diff --git a/.spec/specs/2026-10-24_add-blog-skeleton/tasks.md b/.spec/specs/2026-10-24_add-blog-skeleton/tasks.md index f0fd69c..967a06d 100644 --- a/.spec/specs/2026-10-24_add-blog-skeleton/tasks.md +++ b/.spec/specs/2026-10-24_add-blog-skeleton/tasks.md @@ -47,7 +47,7 @@ - boundary: 只写 geek 组件(keyboard+? 帮助浮层、built-from 注入 vite define、ClientRouter、项目墙构建时 fetch 双源+缓存兜底 JSON);不改页面结构 - verify: `pnpm astro build && grep -q "built from" dist/index.html -i && grep -q "ClientRouter\|view-transition" dist/index.html` -- [ ] T8 Pagefind + RSS + sitemap + Artalk 占位 +- [x] T8 Pagefind + RSS + sitemap + Artalk 占位 - depends-on: task_0006 - claim: orchestrator - boundary: 只加 astro-pagefind/@astrojs-rss/@astrojs-sitemap 集成与文章模板 Artalk 容器组件(无凭据占位);astro.config 修改限集成段 diff --git a/astro.config.mjs b/astro.config.mjs index 6c48e8b..f6e2c20 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -1,5 +1,7 @@ // @ts-check import { defineConfig } from 'astro/config'; +import pagefind from 'astro-pagefind'; +import sitemap from '@astrojs/sitemap'; import { execSync } from 'node:child_process'; // 构建透明(T7):commit/时间经 vite.define 注入,页脚与 /about 引用。 @@ -15,6 +17,7 @@ const date = export default defineConfig({ site: 'https://wait4x.online', + integrations: [pagefind(), sitemap()], vite: { define: { 'import.meta.env.GIT_COMMIT_SHA': JSON.stringify(sha), diff --git a/package.json b/package.json index c3c1954..8e14cc3 100644 --- a/package.json +++ b/package.json @@ -10,9 +10,12 @@ "astro": "astro" }, "dependencies": { + "@astrojs/rss": "^4.0.19", + "@astrojs/sitemap": "^3.7.4", "@fontsource/jetbrains-mono": "^5.3.0", "@fontsource/noto-sans-sc": "^5.3.1", "astro": "^7.3.8", + "astro-pagefind": "^2.0.1", "exifr": "^7.1.3", "lxgw-wenkai-screen-webfont": "^1.7.0", "sharp": "^0.35.5" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index aa10da9..6215b51 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,6 +8,12 @@ importers: .: dependencies: + '@astrojs/rss': + specifier: ^4.0.19 + version: 4.0.19 + '@astrojs/sitemap': + specifier: ^3.7.4 + version: 3.7.4 '@fontsource/jetbrains-mono': specifier: ^5.3.0 version: 5.3.0 @@ -16,7 +22,10 @@ importers: version: 5.3.1 astro: specifier: ^7.3.8 - version: 7.3.8(yaml@2.9.1) + version: 7.3.8(@types/node@24.19.2)(yaml@2.9.1) + astro-pagefind: + specifier: ^2.0.1 + version: 2.0.1(astro@7.3.8(@types/node@24.19.2)(yaml@2.9.1)) exifr: specifier: ^7.1.3 version: 7.1.3 @@ -25,7 +34,7 @@ importers: version: 1.7.0 sharp: specifier: ^0.35.5 - version: 0.35.5 + version: 0.35.5(@types/node@24.19.2) packages: @@ -110,6 +119,12 @@ packages: resolution: {integrity: sha512-KTivpmnz6lDsC6o9H4+DNm2SrE/GHzw8cNAvEJwAvUT+eoaEnn/4NtbDNfRRaxaJHdp15gf+tfHAWiXR4wB3BA==} engines: {node: '>=22.12.0'} + '@astrojs/rss@4.0.19': + resolution: {integrity: sha512-e+z5wYeYtffQdHQO8c2tkSd2JEBdAuRXJV4ZEU5IxkYeE6e39woDd7nw1PH1Kk2tEYNCYuKdylnnbhGmt61awA==} + + '@astrojs/sitemap@3.7.4': + resolution: {integrity: sha512-LbKNC24bdUWcQf/pThB6qLlSqHojxGjZDURIzFocY8rlWnAn2t74nnhnK6S5x0NHriHoAduLEpVjRykmeGiVvA==} + '@astrojs/telemetry@3.3.3': resolution: {integrity: sha512-C1TLn5sPJr0x4vk56piHWKbnqlEB8BKyte5Y45V02U+D7BGO5eMqZDH5aPjnkXQWJggvmsTXxH03QMZ9NgWLzQ==} engines: {node: 18.20.8 || ^20.3.0 || >=22.0.0} @@ -388,12 +403,56 @@ packages: '@emnapi/core': ^1.7.1 || ^2.0.0-alpha.4 '@emnapi/runtime': ^1.7.1 || ^2.0.0-alpha.4 + '@nodable/entities@3.1.0': + resolution: {integrity: sha512-LsS/DjHr+uDM647Gru/cA8+J3a3HfhttwCKLyuoyN7yXTFCxKBtSgMQBvrW9yNPa2/zDRUNuGPaH5QUFoa4arQ==} + '@oslojs/encoding@1.1.0': resolution: {integrity: sha512-70wQhgYmndg4GCPxPPxPGevRKqTIJ2Nh4OkiMWmDAVYsTQ+Ta7Sq+rPevXyXGdzr30/qZBnyOalCszoMxlyldQ==} '@oxc-project/types@0.155.0': resolution: {integrity: sha512-SeE8JPwW1xs1tHeNycjUtUBdhorRa8o4jlvjwk49R7/Z291i+4DQa7JJIgOm/TaYQZx+QrPQbVJ/9c8dMIZN8Q==} + '@pagefind/component-ui@1.5.2': + resolution: {integrity: sha512-t8/aE0tan4JiKa6cyhhSt/5qrEVwAK/qlYBHFpnRoq+qaFFVrhmXFFMY+r6n4GJtVIFCN2A5nUpeLN68cYjEjw==} + + '@pagefind/darwin-arm64@1.5.2': + resolution: {integrity: sha512-MXpI+7HsAdPkvJ0gk9xj9g541BCqBZOBbdwj9g6lB5LCj6kSV6nqDSjzcAJwvOsfu0fjwvC8hQU+ecfhp+MpiQ==} + cpu: [arm64] + os: [darwin] + + '@pagefind/darwin-x64@1.5.2': + resolution: {integrity: sha512-IojxFWMEJe0RQ7PQ3KXQsPIImNsbpPYpoZ+QUDrL8fAl/O27IX+LVLs74/UzEZy5uA2LD8Nz1AiwKr72vrkZQw==} + cpu: [x64] + os: [darwin] + + '@pagefind/freebsd-x64@1.5.2': + resolution: {integrity: sha512-7EVzo9+0w+2cbe671BtMj10UlNo83I+HrLVLfRxO731svHRJKUfJ/mo05gU14pe9PCfpKNQT8FS3Xc/oDN6pOA==} + cpu: [x64] + os: [freebsd] + + '@pagefind/linux-arm64@1.5.2': + resolution: {integrity: sha512-Ovt9+K35sqzn8H3ZMXGwls4TD/wMJuvRtShHIsmUQREmaxjrDEX7gHckRCrwYJ4XE1H1p6HkLz3wukrAnsfXQw==} + cpu: [arm64] + os: [linux] + + '@pagefind/linux-x64@1.5.2': + resolution: {integrity: sha512-V+tFqHKXhQKq/WqPBD67AFy7scn1/aZID00ws4fSDd+1daSi5UHR9VVlRrOUYKxn3VuFQYRD7lYXdZK1WED1YA==} + cpu: [x64] + os: [linux] + + '@pagefind/windows-arm64@1.5.2': + resolution: {integrity: sha512-hN9Nh90fNW61nNRCW9ZyQrAj/mD0eRvmJ8NlTUzkbuW8kIzGJUi3cxjFkEcMZ5h/8FsKWD/VcouZl4yo1F7B6g==} + cpu: [arm64] + os: [win32] + + '@pagefind/windows-x64@1.5.2': + resolution: {integrity: sha512-Fa2Iyw7kaDRzGMfNYNUXNW2zbL5FQVDgSOcbDHdzBrDEdpqOqg8TcZ68F22ol6NJ9IGzvUdmeyZypLW5dyhqsg==} + cpu: [x64] + os: [win32] + + '@polka/url@1.0.0-next.29': + resolution: {integrity: sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww==} + '@rolldown/binding-android-arm-eabi@1.2.15': resolution: {integrity: sha512-aLcgK9gIJ3YRvrrtfSBbRa27F5WrpiTaPulnFpsHPxpUHgFlSgnU4854MHwoRGEBhfRJDWCS2WQ7lIjskE9Olw==} engines: {node: ^20.19.0 || >=22.12.0} @@ -542,12 +601,22 @@ packages: '@types/nlcst@2.0.3': resolution: {integrity: sha512-vSYNSDe6Ix3q+6Z7ri9lyWqgGhJTmzRjZRqyq15N0Z/1/UnVsno9G/N40NBijoYx2seFDIl0+B2mgAb9mezUCA==} + '@types/node@24.19.2': + resolution: {integrity: sha512-93d49wCWJkCyN87MxLpNN6KXPCwFw7bVUg79mGUV1OS40JGWwVCr8n61DXCSqz7CV6/VfPkb7xec7uP2M+QHWQ==} + + '@types/sax@1.2.7': + resolution: {integrity: sha512-rO73L89PJxeYM3s3pPPjiPgVVcymqU490g0YO5n5By0k2Erzj6tay/4lr1CHAAU4JyOWd1rpQ8bCf6cZfHU96A==} + '@types/unist@3.0.3': resolution: {integrity: sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==} '@ungap/structured-clone@1.4.0': resolution: {integrity: sha512-1mEZtMKPM09vDmQt5y7YvmN2+DFTP7Tg0EWXdic8/C6VRnpb33e4ghisCIE3WZjsE2N8mf+QV1Zqh7ZFYLWInQ==} + adequate-little-templates@1.0.2: + resolution: {integrity: sha512-d0tFFG538l3Y4CElRKtticzrMr/OGohs32/nf3Ewn8rbTMBYwkVNe8mPdXWrDnMlz+ZVUFQjsTmsBD5zCtU4wg==} + engines: {node: '>=14'} + am-i-vibing@0.5.0: resolution: {integrity: sha512-KLcsDhqf1XRrJmJr+9I/C0EX2K+sGrAGZFgkmd84c8TJO9zJBu+/kFInjazu1KfJWFhWDKdRWkpBzEs7s35DVA==} hasBin: true @@ -556,10 +625,21 @@ packages: resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} engines: {node: '>= 8'} + anynum@1.0.1: + resolution: {integrity: sha512-N6//FLET/tXYNM/F6ABca1oH6fWB+KlTt909Le28WMDBk8oaT4vY17DCrwg2MvmuqUKt3Ni4N5dGJ/EoBgcO6A==} + + arg@5.0.2: + resolution: {integrity: sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==} + aria-query@5.3.2: resolution: {integrity: sha512-COROpnaoap1E2F000S62r6A60uHZnmlvomhfyT2DlTcrY1OrBKn2UhH7qn5wTC9zMvD0AY7csdPSNwKP+7WiQw==} engines: {node: '>= 0.4'} + astro-pagefind@2.0.1: + resolution: {integrity: sha512-zhMTctuVuKrYH1C0Xl+p8mhexEuxVrqfT8paQOAbKZFtgUIWAMtR2nCeU11ti4Rfeit16LhiCxZFwjOqYoiaNQ==} + peerDependencies: + astro: ^2.0.4 || ^3 || ^4 || ^5 || ^6 || ^7 + astro@7.3.8: resolution: {integrity: sha512-LHzDHSaV+YzZiR3EFndDYTLLeNeuMtP1qX1FLcCNUUHOCqTTIWPczy2UV3zpA5VqvJe5cWZolqM9Z8JFqR2i9w==} engines: {node: '>=22.12.0', npm: '>=9.6.5', pnpm: '>=7.1.0'} @@ -577,6 +657,9 @@ packages: bail@2.0.2: resolution: {integrity: sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==} + bcp-47@2.1.2: + resolution: {integrity: sha512-wsv86UuNFuPnVieKLyECTT+CP1WSAHeoIg5P3xu2kA9Z+7fVPoKt7dxzSeEhtJel0AI+NW3fIW3KtTKQKUCngg==} + boolbase@1.0.0: resolution: {integrity: sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==} @@ -707,6 +790,13 @@ packages: fast-wrap-ansi@0.2.2: resolution: {integrity: sha512-7F2Fl+TjRSenLqlU3UjSH0iyqopqoZIu7eZVpEirP2g1GtWa2G/ecEmBdgz31+Mxr+ELclgg6sokpSFIQiZ02Q==} + fast-xml-builder@1.3.1: + resolution: {integrity: sha512-pIM/1n3ntFXKYrUZwW7QCK0gAW7XY+wzj1YMIV3tLDvPj/V+zTGJK5e3/4WJfwj0qWw2ElNXiTixda/R+3YSug==} + + fast-xml-parser@5.11.2: + resolution: {integrity: sha512-R9iDuNrQYeQut46cn2r2wHKn4HYzVDvDm5J1wW+koZewykv0yuO2HChTYeZtrULyHIDM9cj9TUXloCsueCQUog==} + hasBin: true + fdir@6.5.0: resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==} engines: {node: '>=12.0.0'} @@ -764,6 +854,15 @@ packages: iron-webcrypto@1.2.1: resolution: {integrity: sha512-feOM6FaSr6rEABp/eDfVseKyTMDt+KGpeB35SkVn9Tyn0CqvVsY3EwI0v5i8nMHyJnzCIQf7nsy3p41TPkJZhg==} + is-alphabetical@2.0.1: + resolution: {integrity: sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==} + + is-alphanumerical@2.0.1: + resolution: {integrity: sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==} + + is-decimal@2.0.1: + resolution: {integrity: sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==} + is-docker@4.0.0: resolution: {integrity: sha512-LHE+wROyG/Y/0ZnbktRCoTix2c1RhgWaZraMZ8o1Q7zCh0VSrICJQO5oqIIISrcSBtrXv0o233w1IYwsWCjTzA==} engines: {node: '>=20'} @@ -773,6 +872,9 @@ packages: resolution: {integrity: sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==} engines: {node: '>=12'} + is-unsafe@2.0.2: + resolution: {integrity: sha512-HgbIHPBH0KHHCcjLfGsCvhtPTVxjaAZlXjwdz7/GQC40SjSe4sfQsar8J5VFo8JOSbarkpV0OLG95bbaNd9aAQ==} + jsonc-parser@3.3.1: resolution: {integrity: sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==} @@ -947,6 +1049,14 @@ packages: package-manager-detector@1.9.0: resolution: {integrity: sha512-zAMfbta9nPA8AKkA4WdmNAT8R8s6Dk0/xwPsqNnRidMFcLo1YkLuPDTgs2f64XdzS8vbLNnoJ+uUIkgbz7oRHA==} + pagefind@1.5.2: + resolution: {integrity: sha512-XTUaK0hXMCu2jszWE584JGQT7y284TmMV9l/HX3rnG5uo3rHI/uHU56XTyyyPFjeWEBxECbAi0CaFDJOONtG0Q==} + hasBin: true + + path-expression-matcher@1.6.2: + resolution: {integrity: sha512-enSlaiat05iasnzmgNxRj8reFdj3puY2QpNgP1aPIaVfT6nn9ICuPoFlKHk8EN22HcwewshO+mN2DGbkCEOtqQ==} + engines: {node: '>=14.0.0'} + piccolore@0.1.3: resolution: {integrity: sha512-o8bTeDWjE086iwKrROaDf31K0qC/BENdm15/uH9usSC/uZjJOKb2YGiVHfLY4GhwsERiPI1jmwI2XrA7ACOxVw==} @@ -1028,9 +1138,18 @@ packages: resolution: {integrity: sha512-OcRW72ngQvc+MSVWBRIovC/BTW589iUE/Vxav7VeM4RcY9MUjqB+IR6ILG1k9nuW6LiG/nct9uma4/MBtnZbmQ==} engines: {node: '>=20'} + sirv@3.0.2: + resolution: {integrity: sha512-2wcC/oGxHis/BoHkkPwldgiPSYcpZK3JU28WoMVv55yHJgcZ8rlXvuG9iZggz+sU1d4bRgIGASwyWqjxu3FM0g==} + engines: {node: '>=18'} + sisteransi@1.0.5: resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} + sitemap@9.0.1: + resolution: {integrity: sha512-S6hzjGJSG3d6if0YoF5kTyeRJvia6FSTBroE5fQ0bu1QNxyJqhhinfUsXi9fH3MgtXODWvwo2BDyQSnhPQ88uQ==} + engines: {node: '>=20.19.5', npm: '>=10.8.2'} + hasBin: true + smol-toml@1.9.1: resolution: {integrity: sha512-j7WyPdf0CJoutMzMoPLF/bVXHtKZIT9Rb4eGeEbWw8X2t5oirjPgpL+OpaENZrILYaXqYwnVH+qgUwVbl+pUJQ==} engines: {node: '>= 18'} @@ -1045,6 +1164,9 @@ packages: stringify-entities@4.0.4: resolution: {integrity: sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==} + strnum@2.5.1: + resolution: {integrity: sha512-UM4nTLWzQiDBseVxUGxN0wJzIk0UU89Qi7pKXz9qISo+lhviJikTuikBsK/oFRlpvYHvSdz0TVoLyQ+sEpYwxA==} + svgo@4.1.0: resolution: {integrity: sha512-bkxnTg1kSU0guhIBmibA6UUhrQmPVA1XsQLN+ylCd+UWzbnLkySOcXpyk1mrl05f+pcaCx2eHb+sp6BgMZWX+Q==} engines: {node: '>=16'} @@ -1065,6 +1187,10 @@ packages: resolution: {integrity: sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==} engines: {node: '>=12.0.0'} + totalist@3.0.1: + resolution: {integrity: sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==} + engines: {node: '>=6'} + trim-lines@3.0.1: resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==} @@ -1083,6 +1209,9 @@ packages: uncrypto@0.1.3: resolution: {integrity: sha512-Ql87qFHB3s/De2ClA9e0gsnS6zXG27SkTiSJwjCc9MebbfapQfuPzumMIUMi38ezPZVNFcHI9sUIepeQfw8J8Q==} + undici-types@7.24.6: + resolution: {integrity: sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==} + undici@8.12.3: resolution: {integrity: sha512-+fdndUTwBP86cVjihTp21hZHo7d6oj1c/47XPA3lL8mM0XHs+C4EkcjmgRsFnFk2f/UONGDy9ItBItmXsLOQHw==} engines: {node: '>=22.19.0'} @@ -1231,6 +1360,10 @@ packages: vite: optional: true + xml-naming@0.3.0: + resolution: {integrity: sha512-ghig2TBE/H11aOVgmahA3MhimvkBr6JIYknH/Dhdk10nXwdbIqBJsbfMxpvFPG8bAw77gN29aQWvKpmVoPlvPQ==} + engines: {node: '>=16.0.0'} + xxhash-wasm@1.1.0: resolution: {integrity: sha512-147y/6YNh+tlp6nd/2pWq38i9h6mz/EuQ6njIrmW8D1BS5nCqs0P6DG+m6zTGnNz5I+uhZ0SHxBs9BsPrwcKDA==} @@ -1328,6 +1461,17 @@ snapshots: dependencies: prismjs: 1.30.0 + '@astrojs/rss@4.0.19': + dependencies: + fast-xml-parser: 5.11.2 + piccolore: 0.1.3 + zod: 4.6.7 + + '@astrojs/sitemap@3.7.4': + dependencies: + sitemap: 9.0.1 + zod: 4.6.7 + '@astrojs/telemetry@3.3.3': dependencies: ci-info: 4.4.0 @@ -1553,10 +1697,40 @@ snapshots: '@tybys/wasm-util': 0.10.4 optional: true + '@nodable/entities@3.1.0': {} + '@oslojs/encoding@1.1.0': {} '@oxc-project/types@0.155.0': {} + '@pagefind/component-ui@1.5.2': + dependencies: + adequate-little-templates: 1.0.2 + bcp-47: 2.1.2 + + '@pagefind/darwin-arm64@1.5.2': + optional: true + + '@pagefind/darwin-x64@1.5.2': + optional: true + + '@pagefind/freebsd-x64@1.5.2': + optional: true + + '@pagefind/linux-arm64@1.5.2': + optional: true + + '@pagefind/linux-x64@1.5.2': + optional: true + + '@pagefind/windows-arm64@1.5.2': + optional: true + + '@pagefind/windows-x64@1.5.2': + optional: true + + '@polka/url@1.0.0-next.29': {} + '@rolldown/binding-android-arm-eabi@1.2.15': optional: true @@ -1667,10 +1841,20 @@ snapshots: dependencies: '@types/unist': 3.0.3 + '@types/node@24.19.2': + dependencies: + undici-types: 7.24.6 + + '@types/sax@1.2.7': + dependencies: + '@types/node': 24.19.2 + '@types/unist@3.0.3': {} '@ungap/structured-clone@1.4.0': {} + adequate-little-templates@1.0.2: {} + am-i-vibing@0.5.0: dependencies: process-ancestry: 0.1.0 @@ -1680,9 +1864,20 @@ snapshots: normalize-path: 3.0.0 picomatch: 2.3.2 + anynum@1.0.1: {} + + arg@5.0.2: {} + aria-query@5.3.2: {} - astro@7.3.8(yaml@2.9.1): + astro-pagefind@2.0.1(astro@7.3.8(@types/node@24.19.2)(yaml@2.9.1)): + dependencies: + '@pagefind/component-ui': 1.5.2 + astro: 7.3.8(@types/node@24.19.2)(yaml@2.9.1) + pagefind: 1.5.2 + sirv: 3.0.2 + + astro@7.3.8(@types/node@24.19.2)(yaml@2.9.1): dependencies: '@astrojs/compiler-rs': 0.5.2 '@astrojs/internal-helpers': 0.12.0 @@ -1731,13 +1926,13 @@ snapshots: unifont: 0.7.5 unstorage: 1.17.6 verkit: 0.5.0 - vite: 8.3.5(yaml@2.9.1) - vitefu: 1.1.3(vite@8.3.5(yaml@2.9.1)) + vite: 8.3.5(@types/node@24.19.2)(yaml@2.9.1) + vitefu: 1.1.3(vite@8.3.5(@types/node@24.19.2)(yaml@2.9.1)) xxhash-wasm: 1.1.0 yargs-parser: 22.0.0 zod: 4.6.7 optionalDependencies: - sharp: 0.35.5 + sharp: 0.35.5(@types/node@24.19.2) transitivePeerDependencies: - '@azure/app-configuration' - '@azure/cosmos' @@ -1775,6 +1970,12 @@ snapshots: bail@2.0.2: {} + bcp-47@2.1.2: + dependencies: + is-alphabetical: 2.0.1 + is-alphanumerical: 2.0.1 + is-decimal: 2.0.1 + boolbase@1.0.0: {} ccount@2.0.1: {} @@ -1885,6 +2086,20 @@ snapshots: dependencies: fast-string-width: 3.0.2 + fast-xml-builder@1.3.1: + dependencies: + path-expression-matcher: 1.6.2 + xml-naming: 0.3.0 + + fast-xml-parser@5.11.2: + dependencies: + '@nodable/entities': 3.1.0 + fast-xml-builder: 1.3.1 + is-unsafe: 2.0.2 + path-expression-matcher: 1.6.2 + strnum: 2.5.1 + xml-naming: 0.3.0 + fdir@6.5.0(picomatch@4.0.7): optionalDependencies: picomatch: 4.0.7 @@ -1948,10 +2163,21 @@ snapshots: iron-webcrypto@1.2.1: {} + is-alphabetical@2.0.1: {} + + is-alphanumerical@2.0.1: + dependencies: + is-alphabetical: 2.0.1 + is-decimal: 2.0.1 + + is-decimal@2.0.1: {} + is-docker@4.0.0: {} is-plain-obj@4.1.0: {} + is-unsafe@2.0.2: {} + jsonc-parser@3.3.1: {} lightningcss-android-arm64@1.33.0: @@ -2101,6 +2327,18 @@ snapshots: package-manager-detector@1.9.0: {} + pagefind@1.5.2: + optionalDependencies: + '@pagefind/darwin-arm64': 1.5.2 + '@pagefind/darwin-x64': 1.5.2 + '@pagefind/freebsd-x64': 1.5.2 + '@pagefind/linux-arm64': 1.5.2 + '@pagefind/linux-x64': 1.5.2 + '@pagefind/windows-arm64': 1.5.2 + '@pagefind/windows-x64': 1.5.2 + + path-expression-matcher@1.6.2: {} + piccolore@0.1.3: {} picocolors@1.1.1: {} @@ -2185,7 +2423,7 @@ snapshots: semver@7.8.5: {} - sharp@0.35.5: + sharp@0.35.5(@types/node@24.19.2): dependencies: '@img/colour': 1.1.0 detect-libc: 2.1.2 @@ -2216,6 +2454,7 @@ snapshots: '@img/sharp-win32-arm64': 0.35.5 '@img/sharp-win32-ia32': 0.35.5 '@img/sharp-win32-x64': 0.35.5 + '@types/node': 24.19.2 shiki@4.5.0: dependencies: @@ -2228,8 +2467,21 @@ snapshots: '@shikijs/vscode-textmate': 10.1.0 '@types/hast': 3.0.5 + sirv@3.0.2: + dependencies: + '@polka/url': 1.0.0-next.29 + mrmime: 2.0.1 + totalist: 3.0.1 + sisteransi@1.0.5: {} + sitemap@9.0.1: + dependencies: + '@types/node': 24.19.2 + '@types/sax': 1.2.7 + arg: 5.0.2 + sax: 1.6.1 + smol-toml@1.9.1: {} source-map-js@1.2.2: {} @@ -2241,6 +2493,10 @@ snapshots: character-entities-html4: 2.1.0 character-entities-legacy: 3.0.0 + strnum@2.5.1: + dependencies: + anynum: 1.0.1 + svgo@4.1.0: dependencies: commander: 11.1.0 @@ -2262,6 +2518,8 @@ snapshots: fdir: 6.5.0(picomatch@4.0.7) picomatch: 4.0.7 + totalist@3.0.1: {} + trim-lines@3.0.1: {} trough@2.2.0: {} @@ -2275,6 +2533,8 @@ snapshots: uncrypto@0.1.3: {} + undici-types@7.24.6: {} + undici@8.12.3: {} unified@11.0.5: @@ -2339,7 +2599,7 @@ snapshots: '@types/unist': 3.0.3 vfile-message: 4.0.3 - vite@8.3.5(yaml@2.9.1): + vite@8.3.5(@types/node@24.19.2)(yaml@2.9.1): dependencies: lightningcss: 1.33.0 picomatch: 4.0.7 @@ -2347,12 +2607,15 @@ snapshots: rolldown: 1.2.15 tinyglobby: 0.2.17 optionalDependencies: + '@types/node': 24.19.2 fsevents: 2.3.3 yaml: 2.9.1 - vitefu@1.1.3(vite@8.3.5(yaml@2.9.1)): + vitefu@1.1.3(vite@8.3.5(@types/node@24.19.2)(yaml@2.9.1)): optionalDependencies: - vite: 8.3.5(yaml@2.9.1) + vite: 8.3.5(@types/node@24.19.2)(yaml@2.9.1) + + xml-naming@0.3.0: {} xxhash-wasm@1.1.0: {} diff --git a/src/components/ArtalkComments.astro b/src/components/ArtalkComments.astro new file mode 100644 index 0000000..a10695b --- /dev/null +++ b/src/components/ArtalkComments.astro @@ -0,0 +1,43 @@ +--- +// Artalk 评论挂载(Phase 0 已部署 @ https://wait4x.online/artalk) +// 懒加载:进入视口才拉 Artalk.js,长文页不为其付首屏成本 +interface Props { + pageKey: string; // 评论流键:中英双语页共用同一 slug(评论不分裂) + pageTitle: string; +} +const { pageKey, pageTitle } = Astro.props; +--- + +
+ + diff --git a/src/components/SearchDialog.astro b/src/components/SearchDialog.astro new file mode 100644 index 0000000..78b9f45 --- /dev/null +++ b/src/components/SearchDialog.astro @@ -0,0 +1,101 @@ +--- +// 站内搜索(Pagefind):首次打开才懒加载索引(spectre 模式,见调研报告 §4c) +// 入口:Header 搜索钮 + 键盘 `/` +--- + + + + +

索引由 Pagefind 构建期生成 · 静态站零后端

+
+ + + + diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro index e6f33ca..1d7a630 100644 --- a/src/layouts/BaseLayout.astro +++ b/src/layouts/BaseLayout.astro @@ -12,6 +12,7 @@ import Header from '../components/Header.astro'; import Footer from '../components/Footer.astro'; import ThemeScript from '../components/ThemeScript.astro'; import Keyboard from '../components/geek/Keyboard.astro'; +import SearchDialog from '../components/SearchDialog.astro'; import BuildInfo from '../components/geek/BuildInfo.astro'; import { ClientRouter } from 'astro:transitions'; @@ -47,5 +48,6 @@ const { title, description = 'wait4x 的博客:阅读 · 技术 · 摄影', tr + diff --git a/src/pages/archives/[...slug].astro b/src/pages/archives/[...slug].astro index e6d8b4f..b673601 100644 --- a/src/pages/archives/[...slug].astro +++ b/src/pages/archives/[...slug].astro @@ -2,6 +2,7 @@ import type { CollectionEntry } from 'astro:content'; import { getCollection, render } from 'astro:content'; import BaseLayout from '../../layouts/BaseLayout.astro'; +import ArtalkComments from '../../components/ArtalkComments.astro'; import { trackOf } from '../../content.config'; // URL = /archives/{slug},slug 即文件名,与 Halo 旧结构 1:1(不可改) @@ -104,8 +105,7 @@ const toc = headings.filter((h) => h.depth === 2 || h.depth === 3); )} - -
+