Skip to content

Blocks ​

A block draws one of your objects inside a page. Movies draws a movie as a card with its poster.

json
"blocks": [
  { "id": "card", "title": "Movie card", "entry": "card.html", "types": ["movie"], "height": 100 }
]
Key
idThe block's key.
titleIts name in the / menu, up to 40 characters.
entryIts HTML page.
typesYour type keys it draws. At least one.
heightIts starting height in pixels, 40 to 800. 160 if left out.
moduleOptional. Run natively when signed by Sorus.

Where blocks show ​

  • In a page's / menu. Choosing the block makes a new object of its first type and embeds it there.
  • For any object of those types embedded on a line of its own, however it got there.

Within a sentence, the object shows as a plain link.

Drawing it ​

pages.block.objectId is the object to draw:

js
const pages = await connect()
const row = await pages.client.objects.get({ id: pages.block.objectId })
const movie = pages.values(row, 'movie')
// draw it…
pages.resize(document.body.scrollHeight)

pages.resize(height) asks Sorus for a new height. A click can open the object with pages.navigate({ object: row.id }).