site: rename "finds" superpost collection to "bundles"
Disambiguates the one-letter `find` (item) vs `finds` (roundup) split that
kept causing confusion. Audience-facing now: `/bundles/<slug>/`, "Bundle"
labels in home/footer/search.
Internals: `getCollection('finds')` → `('bundles')`, `Entry.type 'finds'`
→ `'bundle'`, `OgFallback 'finds'` → `'bundles'`, `findListMosaic` →
`bundleMosaic`, `FindsPost` → `Bundle`, `findsReferencing` →
`bundlesReferencing`. Build script + generated mosaic dir follow
(`scripts/build-bundle-mosaics.mjs`, `src/generated/bundle-mosaics/`).
Skills `build-finds` → `build-bundle`, `cluster-finds` →
`cluster-bundles`. The `find` collection (individual items) is unchanged.
No URL redirects: low external-link surface area.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// Build-time generator: for each list in src/content/finds, compose a
|
||||
// mosaic JPG from the item heroes available in that list. Skips work
|
||||
// Build-time generator: for each bundle in src/content/bundles, compose a
|
||||
// mosaic JPG from the item heroes available in that bundle. Skips work
|
||||
// when output is newer than every input. Layout depends on hero count:
|
||||
// 0 -> no mosaic (file is removed if it exists)
|
||||
// 1 -> 1200x1200 single image
|
||||
@@ -15,9 +15,9 @@ import sharp from 'sharp';
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const ROOT = resolve(__dirname, '..');
|
||||
const FINDS_DIR = join(ROOT, 'src/content/finds');
|
||||
const BUNDLES_DIR = join(ROOT, 'src/content/bundles');
|
||||
const FIND_DIR = join(ROOT, 'src/content/find');
|
||||
const OUT_DIR = join(ROOT, 'src/generated/list-mosaics');
|
||||
const OUT_DIR = join(ROOT, 'src/generated/bundle-mosaics');
|
||||
|
||||
const TILE = 598;
|
||||
const GAP = 4;
|
||||
@@ -122,7 +122,7 @@ async function tryUnlink(path) {
|
||||
|
||||
async function main() {
|
||||
await mkdir(OUT_DIR, { recursive: true });
|
||||
const listDirs = (await readdir(FINDS_DIR, { withFileTypes: true }))
|
||||
const bundleDirs = (await readdir(BUNDLES_DIR, { withFileTypes: true }))
|
||||
.filter((d) => d.isDirectory())
|
||||
.map((d) => d.name);
|
||||
|
||||
@@ -131,13 +131,13 @@ async function main() {
|
||||
let removed = 0;
|
||||
let absent = 0;
|
||||
|
||||
for (const listSlug of listDirs) {
|
||||
const mdxPath = join(FINDS_DIR, listSlug, 'index.mdx');
|
||||
const mdPath = join(FINDS_DIR, listSlug, 'index.md');
|
||||
for (const bundleSlug of bundleDirs) {
|
||||
const mdxPath = join(BUNDLES_DIR, bundleSlug, 'index.mdx');
|
||||
const mdPath = join(BUNDLES_DIR, bundleSlug, 'index.md');
|
||||
const sourcePath = existsSync(mdxPath) ? mdxPath : existsSync(mdPath) ? mdPath : null;
|
||||
if (!sourcePath) continue;
|
||||
|
||||
const outPath = join(OUT_DIR, `${listSlug}.jpg`);
|
||||
const outPath = join(OUT_DIR, `${bundleSlug}.jpg`);
|
||||
const fm = await readFrontmatter(sourcePath);
|
||||
const items = parseItems(fm);
|
||||
if (items.length === 0) {
|
||||
@@ -165,10 +165,10 @@ async function main() {
|
||||
|
||||
await buildMosaic(heroPaths, outPath);
|
||||
built++;
|
||||
console.log(` built ${listSlug}.jpg (${heroPaths.length}-up)`);
|
||||
console.log(` built ${bundleSlug}.jpg (${heroPaths.length}-up)`);
|
||||
}
|
||||
console.log(
|
||||
`list mosaics: ${built} built, ${skipped} up-to-date, ${removed} removed, ${absent} skipped (no heroes)`
|
||||
`bundle mosaics: ${built} built, ${skipped} up-to-date, ${removed} removed, ${absent} skipped (no heroes)`
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user