Dynamic label from page in blueprint


I’d like to add dynamic information about a field (in this case, of a page), to my block’s label. Something like this:

My blueprint so far is this:

name: Contact
icon: user
label: "{{ contact.toPage.name }}"
    type: pages
    query: site.find('profiles').children
    multiple: false
    layout: cards
    size: medium
    info: "{{ page.position }} <br> {{ page.email }} <br> {{ page.phone }}"

When I just use label: "{{ contact }}", it showed [object Object].
Is there a way to tap into that object?

I could get it to work with simple values, but I was hoping seeing as I’m fetching just a single page object, I could fetch the only item and get its value.

Is this possible?


No, that’s not possible without a proper preview, since you cannot use blueprint query language here (even if it looks similar, the curly brackets are only resolved as template string).

I guess this is not already a Kirby 4 project, right? Otherwise I would have suggested the fields preview type.

Oh, it is a Kirby 4 project! Could you please point me to where/how I can utilise the fields preview type?

Edit: Ah, field previews is only for Kirby 3?

Nope, that’s something else. What I meant:

Don’t know if this helps…

Thank you @texnixe !
I tried it, but don’t think it will work for this use case, especially on slimmer layouts:

Also, despite having wysiwyg: false, you’re still able to directly click and edit the page.

I ended up converting to a simple multiselect instead, and will fetch the page object via its page id on render.

But, thank you for suggesting preview: fields; I think I can use it elsewhere in my project!