Block library: item headings follow the section; the leading block's first image is the LCP image

Found by ipal-doctor live-seo on the reference archive pages (entry list under a
page header without a picture): cards jumped h1 → h3, and the first card image
was lazy.

- itemHeadingLevel: items one below the section heading (h3 under h2, h2 under the
  page h1, h2 when the block shows no heading); createBlockRegistry({ itemHeadings })
  fixes a level per block. featureGrid, entryList, pricing, steps, team.
- blockPosition / blockHasImage (root): createPageRoute and the 404 view pass
  firstImage next to isFirst; leadsWithImage marks the first image of the leading
  block eager + fetchPriority high (hero, textMedia, featureGrid, gallery, team,
  entryList); priorityImage: false turns it off.
- reference/ipal-doctor.json: the two live-seo silences removed; reference skills
  and docs/agent/reference-site/INDEX.md refreshed.
- bin/ipal-blocks.mjs executable like the other bins.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-10-29 16:38:04 +01:00
co-authored by Claude Opus 5.5
parent dd11bc8146
commit 6f56ef4205
27 changed files with 206 additions and 53 deletions
+10 -3
View File
@@ -108,8 +108,12 @@ block has them) → `variant` (sidebar) → `settings` (sidebar: anchor, backgro
| `entryList` (`buildEntryListBlock`) | Entry list | `entryCollection`, `mode` (latest / chosen), `limit`, `entries` | `cards`, `list` | each title links to its entry and covers the card; dates in `<time>` |
**Rules every block meets:** one `<section>` with `aria-labelledby` its heading and `data-ipal-block`; `h1` only in the
first block (`isFirst` from `createPageRoute`), `h2` otherwise, items `h3`; images through `Media` (alt from the media
document, width and height, lazy except the hero); visible focus (`outline-focus`); no autoplay, motion only through
first block (`isFirst` from `createPageRoute`), `h2` otherwise; **item headings one level below the section heading**
(`itemHeadingLevel`: `h3` under a section `h2`, `h2` under the page `h1`, and `h2` when the block shows no heading of its
own — a list right under the page header never jumps from `h1` to `h3`); images through `Media` (alt from the media
document, width and height, lazy) — **except the page's LCP image**: the first image of the block that leads the page
(`leadsWithImage`: the first section, or `firstImage` from `createPageRoute` — no block before it shows an image, e.g. an
entry list under a page header without a picture) loads eagerly with `fetchPriority="high"`, one per block; visible focus (`outline-focus`); no autoplay, motion only through
the token durations (0 ms under reduced motion); **an empty block renders nothing** (no empty section, no "Lorem").
**Visitor texts** the components write themselves — `rating` ("Rated {value} out of 5") and `step` ("Step {value}") —
@@ -166,6 +170,8 @@ plugin's components. `content` needs `resolveLink`; `getEntries` (entry list), `
| `sendForm`, `formClassNames`, `contactDetails` | the contact block: form action, form classes, details beside the form |
| `entryCard`, `mapTestimonial` | how a collection document becomes an entry card / a testimonial (defaults `defaultEntryCard`, `defaultTestimonial`) |
| `noSnippet` | blocks kept out of Google's snippets (`<NoSnippet>`), e.g. `['cta']` when the same call to action is on every page (docs/seo.md) |
| `itemHeadings` | item heading level per block, e.g. `{ entryList: 'h3' }` (`h2` / `h3` / `h4`) — default: one below the section heading |
| `priorityImage` | `false` = never mark a block's first image as the LCP image (default on) |
| `icons`, `texts`, `lightbox`, `richText` | feature icons by name; visitor texts; `lightbox: false` = plain gallery images; `richText.className` for every rich text |
**UI primitives** (`/blocks/rsc`), each styled once with token utilities: `Section` (anchor, background,
@@ -176,7 +182,8 @@ keeps its content without a link, so an empty link group never hides it),
`buttonClass` / `BUTTON_CLASSES` (button looks by appearance), `Container` / `CONTAINER_WIDTHS`, `Card` / `CARD_CLASS` /
`CARD_INTERACTIVE_CLASS`. Helpers for the project's own blocks: `Buttons` (a block's button row), `headingId(block)`
(the heading id for `aria-labelledby`), `TitleLink` (a card title that links when its link resolves), `GRID_COLUMNS`,
`cx`, `parts(defaults, overrides)`.
`cx`, `parts(defaults, overrides)`, `itemHeadingLevel(slug, props)` (the item heading tag) and `leadsWithImage(props)`
(whether the block's first image is the LCP image).
**Every component is exported** (`HeroBlock`, `TextMediaBlock`, `FeatureGridBlock`, `GalleryBlock`, `FaqBlock`, `CtaBlock`,
`ContactBlock`, `TeamBlock`, `PricingBlock`, `LogosBlock`, `TestimonialsBlock`, `StatsBlock`, `RichTextBlock`,