From 64d5bfe922bed2c63f9268cdbedf91d56f2632e1 Mon Sep 17 00:00:00 2001 From: Niko Date: Tue, 11 Mar 2025 17:03:06 +0100 Subject: [PATCH 1/3] Add static search --- astro.config.mjs | 2 + package.json | 7 +- pagefind.yml | 2 + src/components/header/header-actions.astro | 125 +++++++++++++++++++++ 4 files changed, 133 insertions(+), 3 deletions(-) create mode 100644 pagefind.yml diff --git a/astro.config.mjs b/astro.config.mjs index dd63dfc8d..f89c995ba 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -8,6 +8,7 @@ import remarkToc from "remark-toc"; import rehypeSlug from "rehype-slug"; import rehypeAutolinkHeadings from "rehype-autolink-headings"; import metaTags from "astro-meta-tags"; +import pagefind from "astro-pagefind"; // https://astro.build/config export default defineConfig({ @@ -42,6 +43,7 @@ export default defineConfig({ nesting: true, }), metaTags(), + pagefind(), ], output: "static", }); diff --git a/package.json b/package.json index 6ced2d2d6..620051f51 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "scripts": { "dev": "astro dev", "start": "astro dev", - "build": "astro check && astro build", + "build": "astro check && astro build && pnpm pagefind --site dist", "preview": "astro preview", "astro": "astro", "format": "prettier --write --plugin=prettier-plugin-astro ." @@ -19,10 +19,11 @@ "@astrojs/tailwind": "^5.1.4", "@fontsource-variable/inter": "^5.1.1", "@tailwindcss/typography": "^0.5.16", - "@types/react": "^19.0.10", - "@types/react-dom": "^19.0.4", + "@types/react": "^18.0.0", + "@types/react-dom": "^18.3.5", "astro": "^5.1.6", "astro-meta-tags": "^0.3.1", + "astro-pagefind": "^1.8.1", "clsx": "^2.1.1", "date-fns": "^4.1.0", "date-fns-tz": "^3.2.0", diff --git a/pagefind.yml b/pagefind.yml new file mode 100644 index 000000000..f8b526086 --- /dev/null +++ b/pagefind.yml @@ -0,0 +1,2 @@ +site: dist +glob: "**/*.{html}" diff --git a/src/components/header/header-actions.astro b/src/components/header/header-actions.astro index 2786369e8..9f9786fc9 100644 --- a/src/components/header/header-actions.astro +++ b/src/components/header/header-actions.astro @@ -1,6 +1,7 @@ --- import ButtonLink from "../button-link/button-link.astro"; import HeaderButton from "./header-button.astro"; +import Search from "astro-pagefind/components/Search"; export interface Props { mobile?: boolean; @@ -12,6 +13,13 @@ const IS_LIVE = false; ---
+ { !mobile ? ( <> @@ -40,3 +48,120 @@ const IS_LIVE = false;
+ + From 82c6392976a38e496c60dedc198dd7571070004e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 11 Mar 2025 16:24:05 +0000 Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/components/header/header-actions.astro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/header/header-actions.astro b/src/components/header/header-actions.astro index 9f9786fc9..b3a16e0fa 100644 --- a/src/components/header/header-actions.astro +++ b/src/components/header/header-actions.astro @@ -13,7 +13,7 @@ const IS_LIVE = false; ---
- From bfed88167340f8e838b7a9c2e48969f82e118f33 Mon Sep 17 00:00:00 2001 From: Niko Date: Sun, 16 Mar 2025 11:31:17 +0100 Subject: [PATCH 3/3] Update npm packages. --- package.json | 4 +-- pnpm-lock.yaml | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 620051f51..ee949e1e5 100644 --- a/package.json +++ b/package.json @@ -19,8 +19,8 @@ "@astrojs/tailwind": "^5.1.4", "@fontsource-variable/inter": "^5.1.1", "@tailwindcss/typography": "^0.5.16", - "@types/react": "^18.0.0", - "@types/react-dom": "^18.3.5", + "@types/react": "^19.0.10", + "@types/react-dom": "^19.0.4", "astro": "^5.1.6", "astro-meta-tags": "^0.3.1", "astro-pagefind": "^1.8.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 77253f379..c3e8f09df 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -44,6 +44,9 @@ importers: astro-meta-tags: specifier: ^0.3.1 version: 0.3.1(astro@5.5.2(jiti@1.21.7)(rollup@4.35.0)(typescript@5.8.2)(yaml@2.7.0)) + astro-pagefind: + specifier: ^1.8.1 + version: 1.8.3(astro@5.5.2(jiti@1.21.7)(rollup@4.35.0)(typescript@5.8.2)(yaml@2.7.0)) clsx: specifier: ^2.1.1 version: 2.1.1 @@ -566,10 +569,41 @@ packages: '@oslojs/encoding@1.1.0': resolution: {integrity: sha512-70wQhgYmndg4GCPxPPxPGevRKqTIJ2Nh4OkiMWmDAVYsTQ+Ta7Sq+rPevXyXGdzr30/qZBnyOalCszoMxlyldQ==} + '@pagefind/darwin-arm64@1.3.0': + resolution: {integrity: sha512-365BEGl6ChOsauRjyVpBjXybflXAOvoMROw3TucAROHIcdBvXk9/2AmEvGFU0r75+vdQI4LJdJdpH4Y6Yqaj4A==} + cpu: [arm64] + os: [darwin] + + '@pagefind/darwin-x64@1.3.0': + resolution: {integrity: sha512-zlGHA23uuXmS8z3XxEGmbHpWDxXfPZ47QS06tGUq0HDcZjXjXHeLG+cboOy828QIV5FXsm9MjfkP5e4ZNbOkow==} + cpu: [x64] + os: [darwin] + + '@pagefind/default-ui@1.3.0': + resolution: {integrity: sha512-CGKT9ccd3+oRK6STXGgfH+m0DbOKayX6QGlq38TfE1ZfUcPc5+ulTuzDbZUnMo+bubsEOIypm4Pl2iEyzZ1cNg==} + + '@pagefind/linux-arm64@1.3.0': + resolution: {integrity: sha512-8lsxNAiBRUk72JvetSBXs4WRpYrQrVJXjlRRnOL6UCdBN9Nlsz0t7hWstRk36+JqHpGWOKYiuHLzGYqYAqoOnQ==} + cpu: [arm64] + os: [linux] + + '@pagefind/linux-x64@1.3.0': + resolution: {integrity: sha512-hAvqdPJv7A20Ucb6FQGE6jhjqy+vZ6pf+s2tFMNtMBG+fzcdc91uTw7aP/1Vo5plD0dAOHwdxfkyw0ugal4kcQ==} + cpu: [x64] + os: [linux] + + '@pagefind/windows-x64@1.3.0': + resolution: {integrity: sha512-BR1bIRWOMqkf8IoU576YDhij1Wd/Zf2kX/kCI0b2qzCKC8wcc2GQJaaRMCpzvCCrmliO4vtJ6RITp/AnoYUUmQ==} + cpu: [x64] + os: [win32] + '@pkgjs/parseargs@0.11.0': resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} engines: {node: '>=14'} + '@polka/url@1.0.0-next.28': + resolution: {integrity: sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw==} + '@rollup/pluginutils@5.1.4': resolution: {integrity: sha512-USm05zrsFxYLPdWWq+K3STlWiT/3ELn3RcV5hJMghpeAIhxfsUIg6mt12CBJBInWMV4VneoV7SfGv8xIwo2qNQ==} engines: {node: '>=14.0.0'} @@ -861,6 +895,11 @@ packages: peerDependencies: astro: ^4.0.0 || ^5.0.0-beta.0 + astro-pagefind@1.8.3: + resolution: {integrity: sha512-Nfo1TdlEHdkXTiI0KpimLqX6awK3qWTil7IOJvk5Q8x+0VBTpIEp9QvGgoAxXDe3upAHLVsg4y7U1uUPm7GC9w==} + peerDependencies: + astro: ^2.0.4 || ^3 || ^4 || ^5 + astro@5.5.2: resolution: {integrity: sha512-SOTJxB8mqxe/KEYEJiLIot0YULiCffyfTEclwmdeaASitDJ7eLM/KYrJ9sx3U5hq9GVI17Z4Y0P/1T2aQ0ZN3A==} engines: {node: ^18.17.1 || ^20.3.0 || >=22.0.0, npm: '>=9.6.5', pnpm: '>=7.1.0'} @@ -1683,6 +1722,10 @@ packages: package-manager-detector@1.0.0: resolution: {integrity: sha512-7elnH+9zMsRo7aS72w6MeRugTpdRvInmEB4Kmm9BVvPw/SLG8gXUGQ+4wF0Mys0RSWPz0B9nuBbDe8vFeA2sfg==} + pagefind@1.3.0: + resolution: {integrity: sha512-8KPLGT5g9s+olKMRTU9LFekLizkVIu9tes90O1/aigJ0T5LmyPqTzGJrETnSw3meSYg58YH7JTzhTTW/3z6VAw==} + hasBin: true + parse-entities@4.0.2: resolution: {integrity: sha512-GG2AQYWoLgL877gQIKeRPGO1xF9+eG1ujIb5soS5gPvLQ1y2o8FL90w2QWNdf9I361Mpp7726c+lj3U0qK1uGw==} @@ -1978,6 +2021,10 @@ packages: simple-swizzle@0.2.2: resolution: {integrity: sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==} + sirv@3.0.1: + resolution: {integrity: sha512-FoqMu0NCGBLCcAkS1qA+XJIQTR6/JHfQXl+uGteNCQ76T91DMUjPa9xfmeqMY3z80nLSg9yQmNjK0Px6RWsH/A==} + engines: {node: '>=18'} + sisteransi@1.0.5: resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} @@ -2068,6 +2115,10 @@ packages: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.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==} @@ -2985,9 +3036,28 @@ snapshots: '@oslojs/encoding@1.1.0': {} + '@pagefind/darwin-arm64@1.3.0': + optional: true + + '@pagefind/darwin-x64@1.3.0': + optional: true + + '@pagefind/default-ui@1.3.0': {} + + '@pagefind/linux-arm64@1.3.0': + optional: true + + '@pagefind/linux-x64@1.3.0': + optional: true + + '@pagefind/windows-x64@1.3.0': + optional: true + '@pkgjs/parseargs@0.11.0': optional: true + '@polka/url@1.0.0-next.28': {} + '@rollup/pluginutils@5.1.4(rollup@4.35.0)': dependencies: '@types/estree': 1.0.6 @@ -3280,6 +3350,13 @@ snapshots: dependencies: astro: 5.5.2(jiti@1.21.7)(rollup@4.35.0)(typescript@5.8.2)(yaml@2.7.0) + astro-pagefind@1.8.3(astro@5.5.2(jiti@1.21.7)(rollup@4.35.0)(typescript@5.8.2)(yaml@2.7.0)): + dependencies: + '@pagefind/default-ui': 1.3.0 + astro: 5.5.2(jiti@1.21.7)(rollup@4.35.0)(typescript@5.8.2)(yaml@2.7.0) + pagefind: 1.3.0 + sirv: 3.0.1 + astro@5.5.2(jiti@1.21.7)(rollup@4.35.0)(typescript@5.8.2)(yaml@2.7.0): dependencies: '@astrojs/compiler': 2.11.0 @@ -4515,6 +4592,14 @@ snapshots: package-manager-detector@1.0.0: {} + pagefind@1.3.0: + optionalDependencies: + '@pagefind/darwin-arm64': 1.3.0 + '@pagefind/darwin-x64': 1.3.0 + '@pagefind/linux-arm64': 1.3.0 + '@pagefind/linux-x64': 1.3.0 + '@pagefind/windows-x64': 1.3.0 + parse-entities@4.0.2: dependencies: '@types/unist': 2.0.11 @@ -4923,6 +5008,12 @@ snapshots: dependencies: is-arrayish: 0.3.2 + sirv@3.0.1: + dependencies: + '@polka/url': 1.0.0-next.28 + mrmime: 2.0.1 + totalist: 3.0.1 + sisteransi@1.0.5: {} sitemap@8.0.0: @@ -5043,6 +5134,8 @@ snapshots: dependencies: is-number: 7.0.0 + totalist@3.0.1: {} + trim-lines@3.0.1: {} trough@2.2.0: {}