site: list mosaic tiles for /finds/ + home grid

Adds a build-time mosaic generator (scripts/build-list-mosaics.mjs, sharp)
that composites a single tile image per superpost from its referenced
finds. Wired via predev/prestart/prebuild hooks; output lives in
src/generated/ (gitignored). The /finds/ index and home grid both render
the mosaic when present and fall back to text-only tiles otherwise.
This commit is contained in:
2026-05-04 20:34:29 -04:00
parent 315fc71145
commit 99a889523a
6 changed files with 373 additions and 70 deletions
+16
View File
@@ -0,0 +1,16 @@
import type { ImageMetadata } from 'astro';
const modules = import.meta.glob<{ default: ImageMetadata }>(
'../generated/list-mosaics/*.jpg',
{ eager: true }
);
const mosaics = new Map<string, ImageMetadata>();
for (const [path, mod] of Object.entries(modules)) {
const match = path.match(/list-mosaics\/([^/]+)\.jpg$/);
if (match) mosaics.set(match[1], mod.default);
}
export function findListMosaic(slug: string): ImageMetadata | undefined {
return mosaics.get(slug);
}