mirror of
https://github.com/Patiun/com.gregkilmer.www.git
synced 2026-11-07 19:58:24 +00:00
Board game updated pass 1
This commit is contained in:
@@ -177,6 +177,63 @@ PlayStation, Xbox, and Nintendo in one place.
|
||||
|
||||
---
|
||||
|
||||
## Board games (TTRPGs page)
|
||||
|
||||
The "Board games" section on the TTRPGs page reads from a JSON file and renders
|
||||
an interactive shelf: a list of games on the left, and a tall image on the
|
||||
right that cross-fades to a game's BGG cover when you hover its name. Clicking a
|
||||
name opens the game on BoardGameGeek.
|
||||
|
||||
### The list — `src/data/boardgames.json`
|
||||
|
||||
A flat JSON array. Each entry needs a `name` and a `bggId`; `note` and `image`
|
||||
are optional:
|
||||
|
||||
```json
|
||||
[
|
||||
{ "name": "Wingspan", "bggId": 266192, "note": "Engine builder" },
|
||||
{ "name": "Brass: Birmingham", "bggId": 224517 }
|
||||
]
|
||||
```
|
||||
|
||||
| Field | Type | Required | Notes |
|
||||
|---|---|---|---|
|
||||
| `name` | string | yes | Display label + link text |
|
||||
| `bggId` | number | yes | BoardGameGeek numeric id (from its URL) |
|
||||
| `note` | string | no | One-line caption shown under the name |
|
||||
| `image` | string | no | Cover path/URL; populated by the fetch tool |
|
||||
|
||||
Find a game's `bggId` in its BoardGameGeek URL:
|
||||
`https://boardgamegeek.com/boardgame/<bggId>/<slug>`.
|
||||
|
||||
The shelf photo at rest is `/images/ttrpg-boardgame-shelf.jpg` — drop a real
|
||||
photo of your shelf at that path. The image is a **progressive enhancement**:
|
||||
without JS the list still works (links + shelf photo); games without an `image`
|
||||
just keep the shelf photo on hover.
|
||||
|
||||
### Fetching covers (BoardGameGeek)
|
||||
|
||||
`scripts/fetch-bgg-covers.mjs` fills in the `image` field for any game missing
|
||||
one, using BGG's public XML2 API (no key needed):
|
||||
|
||||
```bash
|
||||
# Default: download covers to public/images/boardgames/<bggId>.jpg (recommended)
|
||||
node scripts/fetch-bgg-covers.mjs
|
||||
|
||||
# Instead hotlink BGG's CDN URLs (no download, depends on their CDN)
|
||||
node scripts/fetch-bgg-covers.mjs --remote
|
||||
|
||||
# Re-fetch even games that already have an image
|
||||
node scripts/fetch-bgg-covers.mjs --force
|
||||
|
||||
# Slow down between BGG calls (they rate-limit; default 1200ms)
|
||||
node scripts/fetch-bgg-covers.mjs --sleep 2000
|
||||
```
|
||||
|
||||
It's idempotent — run it again any time you add games to the JSON.
|
||||
|
||||
---
|
||||
|
||||
## Interest pages
|
||||
|
||||
Each interest is a hand-built page in `src/pages/interests/`. They follow the
|
||||
|
||||
Reference in New Issue
Block a user