Problem
Blocks in arrays such as pages.blocks have blockType and position, but no stable per-block ID. That means frontend
consumers can only target blocks by type or index, and index changes on reorder.
Repro
- Create a page with multiple blocks.
- Render them in Astro with DOM hooks.
- Reorder blocks in the CMS.
- Any index-based selector/hook now points at a different block.
Proposal
Add a persisted internal ID for each block item in discriminated block arrays.
Requirements:
- generated once when a block is created
- stored with the block data
- preserved on reorder/edit/save
- available in fetched content
- hidden from normal editorial UI if possible
Example
Current:
{ "blockType": "hero", "heading": "Welcome" }
Desired:
{ "blockId": "blk_abc123", "blockType": "hero", "heading": "Welcome" }
Acceptance criteria
- new block items receive a stable persisted ID
- reorder does not change the ID
- edits do not change the ID
- fetched content includes the ID
- existing content has a backfill/migration path
Problem
Blocks in arrays such as
pages.blockshaveblockTypeand position, but no stable per-block ID. That means frontendconsumers can only target blocks by type or index, and index changes on reorder.
Repro
Proposal
Add a persisted internal ID for each block item in discriminated block arrays.
Requirements:
Example
Current:
{ "blockType": "hero", "heading": "Welcome" }Desired:
Acceptance criteria