Skip to content

TKW: link castles, battles, and events from prose bodies - #91

Merged
codebend3r merged 6 commits into
mainfrom
prose-links-battles-events
Sep 19, 2026
Merged

codebend3r merged 6 commits into
mainfrom
prose-links-battles-events

Conversation

@codebend3r

@codebend3r codebend3r commented Sep 18, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Battle and event pages now render prose links; castles, battles, and events join characters, houses, weapons, and dragons as link targets
  • Every other detail page links castles, battles, and events too; only the castle page still renders without an index
  • 57 battles and 29 events carry curated mentions so first names and bare house names link

Linker

  • buildProseLinkIndex takes allCastles, allBattles, allEvents
  • A name starting with "The" also matches without the article: "the Twins", "the Red Wedding"
  • Self-suppression and once-per-page dedupe keyed by kind plus slug; selfSlug becomes self: { kind, slug }
  • Castles sharing a house's short name (Darry, Rosby, the Hightower) never auto-link, since mentions carries bare slugs
  • mentions also settles a shared name: 50 character names belong to two or more entries, and the one the page lists now wins the surface form

Schema and integrity

  • EventSchema gains aliases and mentions
  • events.mentions validated like battles.mentions

Content

  • mentions curated per entry against date and sentence; namesake hits left out
  • One character per first name per entry, matching the first-registered rule

Tooling

  • populate-entry skill rewritten for the new linking rules
  • audit-orphans.ts updated to the new signature and counts battle and event bodies as link sources

Verification

  • 14 new tests in lib/prose-links.test.ts, lib/schemas.test.ts, lib/content-integrity.test.ts
  • bun run check and bun run build pass; built pages show dragon, castle, and battle links

- `EventSchema` gains `aliases` and `mentions`, both defaulting to `[]`
- `lib/content-integrity.ts` validates `events.mentions` like `battles.mentions`
- `lib/timeline.test.ts` event fixture carries the two new fields
- `buildProseLinkIndex` takes `allCastles`, `allBattles`, `allEvents` and emits `castle`, `battle`, `event` targets
- a name starting with "The" also matches without the article, so "the Twins" and "the Red Wedding" link
- self-suppression and once-per-page dedupe keyed by kind plus slug via `targetKey`
- `ProseLinkIndex.selfSlug` becomes `self: { kind, slug }`
- castles sharing a house's short name (Darry, Rosby, the Hightower) never auto-link; `mentions` cannot tell them apart
- `targetsOf` replaces the four per-kind `flatMap` blocks
- `app/battles/[slug]` and `app/events/[slug]` build a link index and pass `proseLinks` to `renderMarkdown`
- character, house, weapon, and dragon pages pass castles, battles, and events into the index
- 57 battles and 29 events list the characters their bodies name by first name only, and the houses named bare
- every slug checked against date and sentence; namesake hits (Karstarks as ancient Starks, Sept of Baelor as the king) left out
- one character per first name per entry, since the first to register takes the bare name
- `populate-entry` drops the stale "`battles.mentions` does nothing" and "battle bodies never link" rows, adds the `mentions`, alias, and house-named-castle rules, and documents `events.aliases` and `events.mentions`
- `audit-orphans.ts` passes castles, battles, and events into `buildProseLinkIndex`, counts battle and event bodies as link sources, and matches the per-kind self rule
@netlify

netlify Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for theknownworld ready!

Name Link
🔨 Latest commit b7d4a6e
🔍 Latest deploy log https://app.netlify.com/projects/theknownworld/deploys/6aad81f17ec28a0008e43746
😎 Deploy Preview https://deploy-preview-91--theknownworld.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

- 50 character names are shared by two or more entries, and the first to register kept the surface form regardless of the page
- `targetsOf` now orders each kind's entries with the page's `mentions` first, so a page that names the intended entry links to it
- unmentioned collisions keep the previous first-wins order
@codebend3r
codebend3r merged commit f52b87e into main Sep 19, 2026
5 checks passed
@codebend3r
codebend3r deleted the prose-links-battles-events branch September 19, 2026 03:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant