From 8ac5e73d4a81aaafc798ebf4fd1221aaf4a31ea1 Mon Sep 17 00:00:00 2001 From: Laker Turner Date: Wed, 23 Apr 2025 14:47:12 +0100 Subject: [PATCH] we are so back --- astro.config.mjs | 7 +- package.json | 1 + pnpm-lock.yaml | 93 +++++++++++++++++++++++++ src/components/lists/BlogPostList.astro | 59 +++++++++------- src/components/lists/NoteList.astro | 11 ++- src/components/lists/ProjectList.astro | 55 +++++++-------- src/components/ui/Footer.astro | 5 +- src/components/ui/Navigation.astro | 8 ++- src/components/util/Date.astro | 14 +++- src/content.config.ts | 3 +- src/content/about.md | 2 +- src/content/bio.md | 3 +- src/content/colophon.md | 1 + src/content/notes/test2.md | 4 ++ src/content/now.md | 14 ---- src/content/projects/scramble.md | 1 + src/layouts/Note.astro | 85 +++++++++++++--------- src/lib/fun.ts | 1 - src/lib/metadata.ts | 2 +- src/pages/blog/index.astro | 7 +- src/pages/index.astro | 1 + src/pages/meta/colophon.astro | 16 +++++ src/pages/more.astro | 14 ++++ src/site.config.ts | 6 +- src/styles/global.css | 7 +- 25 files changed, 292 insertions(+), 128 deletions(-) create mode 100644 src/content/colophon.md create mode 100644 src/content/notes/test2.md delete mode 100644 src/content/now.md create mode 100644 src/pages/meta/colophon.astro create mode 100644 src/pages/more.astro diff --git a/astro.config.mjs b/astro.config.mjs index 4b4ba61..57f566a 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -2,12 +2,15 @@ import { defineConfig } from 'astro/config'; import config from './src/site.config' import tailwindcss from '@tailwindcss/vite'; - +import pagefind from "astro-pagefind"; // https://astro.build/config export default defineConfig({ site: config.site.url, prefetch: true, vite: { plugins: [tailwindcss()] - } + }, + integrations: [ + pagefind() + ], }); \ No newline at end of file diff --git a/package.json b/package.json index 59061ad..3120329 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "dependencies": { "@tailwindcss/vite": "^4.0.13", "astro": "^5.4.3", + "astro-pagefind": "^1.8.3", "ava": "^6.2.0", "clsx": "^2.1.1", "luxon": "^3.5.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 28528e6..5a2af92 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,6 +14,9 @@ importers: astro: specifier: ^5.4.3 version: 5.4.3(jiti@2.4.2)(lightningcss@1.29.2)(rollup@4.35.0)(typescript@5.8.2) + astro-pagefind: + specifier: ^1.8.3 + version: 1.8.3(astro@5.4.3(jiti@2.4.2)(lightningcss@1.29.2)(rollup@4.35.0)(typescript@5.8.2)) ava: specifier: ^6.2.0 version: 6.2.0(rollup@4.35.0) @@ -356,10 +359,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'} @@ -674,6 +708,11 @@ packages: resolution: {integrity: sha512-tLkvA81vQG/XqE2mjDkGQHoOINtMHtysSnemrmoGe6PydDPMRbVugqyk4A6V/WDWEfm3l+0d8anA9r8cv/5Jaw==} engines: {node: '>=12'} + astro-pagefind@1.8.3: + resolution: {integrity: sha512-Nfo1TdlEHdkXTiI0KpimLqX6awK3qWTil7IOJvk5Q8x+0VBTpIEp9QvGgoAxXDe3upAHLVsg4y7U1uUPm7GC9w==} + peerDependencies: + astro: ^2.0.4 || ^3 || ^4 || ^5 + astro@5.4.3: resolution: {integrity: sha512-GKkOJQCHLx6CrPoghGhj7824WDSvIuuc+HTVjfjMPdB9axp238iJLByREJNDaSdzMeR/lC13xvBiUnKvcYyEIA==} engines: {node: ^18.17.1 || ^20.3.0 || >=22.0.0, npm: '>=9.6.5', pnpm: '>=7.1.0'} @@ -1563,6 +1602,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-latin@7.0.0: resolution: {integrity: sha512-mhHgobPPua5kZ98EF4HWiH167JWBfl4pvAIXXdbaVohtK7a6YBOy56kvhCqduqyo/f3yrHFWmqmiMg/BkBkYYQ==} @@ -1748,6 +1791,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==} @@ -1834,6 +1881,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'} + tr46@0.0.3: resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} @@ -2382,9 +2433,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 @@ -2650,6 +2720,13 @@ snapshots: arrify@3.0.0: {} + astro-pagefind@1.8.3(astro@5.4.3(jiti@2.4.2)(lightningcss@1.29.2)(rollup@4.35.0)(typescript@5.8.2)): + dependencies: + '@pagefind/default-ui': 1.3.0 + astro: 5.4.3(jiti@2.4.2)(lightningcss@1.29.2)(rollup@4.35.0)(typescript@5.8.2) + pagefind: 1.3.0 + sirv: 3.0.1 + astro@5.4.3(jiti@2.4.2)(lightningcss@1.29.2)(rollup@4.35.0)(typescript@5.8.2): dependencies: '@astrojs/compiler': 2.11.0 @@ -3810,6 +3887,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-latin@7.0.0: dependencies: '@types/nlcst': 2.0.3 @@ -4080,6 +4165,12 @@ snapshots: is-arrayish: 0.3.2 optional: true + sirv@3.0.1: + dependencies: + '@polka/url': 1.0.0-next.28 + mrmime: 2.0.1 + totalist: 3.0.1 + sisteransi@1.0.5: {} slash@5.1.0: {} @@ -4167,6 +4258,8 @@ snapshots: dependencies: is-number: 7.0.0 + totalist@3.0.1: {} + tr46@0.0.3: {} trim-lines@3.0.1: {} diff --git a/src/components/lists/BlogPostList.astro b/src/components/lists/BlogPostList.astro index 5a7e619..aeb1f49 100644 --- a/src/components/lists/BlogPostList.astro +++ b/src/components/lists/BlogPostList.astro @@ -4,7 +4,7 @@ import { getCollection } from "astro:content"; import { getPublishedAndSortedPosts } from "~/lib/blog"; interface Props { - limit?: number; + limit?: number; } const { limit } = Astro.props; @@ -12,37 +12,42 @@ const items = getPublishedAndSortedPosts(await getCollection("blog")); const limitedItems = limit ? items.slice(0, limit) : items; const getPostIcon = (item: { data: { icon?: string } }) => { - if (item.data.icon && item.data.icon !== "fa-solid fa-blog") { - return item.data.icon; - } - return "fa-solid fa-arrow-right"; + if (item.data.icon && item.data.icon !== "fa-solid fa-blog") { + return item.data.icon; + } + return "fa-solid fa-arrow-right"; }; --- diff --git a/src/components/lists/NoteList.astro b/src/components/lists/NoteList.astro index 2e86f7e..e4a485c 100644 --- a/src/components/lists/NoteList.astro +++ b/src/components/lists/NoteList.astro @@ -24,10 +24,17 @@ const renderedItems = await Promise.all(
    { renderedItems.map((item) => ( -
  • +
  • - + + { + item.data.title ? ( + + {item.data.title} + + ) : null + }
    diff --git a/src/components/lists/ProjectList.astro b/src/components/lists/ProjectList.astro index e0203cc..376e0ac 100644 --- a/src/components/lists/ProjectList.astro +++ b/src/components/lists/ProjectList.astro @@ -3,43 +3,42 @@ import Date from "~/components/util/Date.astro"; import { getCollection } from "astro:content"; interface Props { - limit?: number; + limit?: number; } const { limit } = Astro.props; const items = await getCollection("projects"); const limitedItems = limit ? items.slice(0, limit) : items; - ---
      - { - limitedItems.map((item) => ( -
    • - + { + limitedItems.map((item) => ( +
    • + - -

      {item.data.name}

      -
      + +

      {item.data.name}

      +
      -

      - - - - {(item.data.tags ?? []).map((tag) => ( - - {tag} - - ))} -

      +

      + + + + {(item.data.tags ?? []).map((tag) => ( + + {tag} + + ))} +

      -
      - {item.data.description} -
      -
    • - )) - } +
      + {item.data.description} +
      + + )) + }
    diff --git a/src/components/ui/Footer.astro b/src/components/ui/Footer.astro index 24b2692..1e02003 100644 --- a/src/components/ui/Footer.astro +++ b/src/components/ui/Footer.astro @@ -5,16 +5,15 @@ import { isBirthday } from "~/lib/fun";