Hi there,
I created a blueprint for my blog. For the cover image I want to include some file info into the info-property, for example the alt-tag. So far I didn’t find a solution, how to do it.
page.yml:
sections:
properties:
label: Info
type: fields
fields:
cover:
label: Header Bild
info: "{{ file.alt }}" # this was my failed attempt
type: files
layout: cards
image:
ratio: 16/9
cover: false
multiple: false
file.yml:
title: files
accept: true
fields:
alt:
label: Alt-Text / Bildunterschrift
type: text
Thank you for your help!
Dominik
You would have to assign this file blueprint to your cover field via the uploads option:
1 Like
Thank you, it works, awesome!
Here is my solution (for others with the same problem and no idea ^^):
sections:
properties:
label: Info
type: fields
fields:
cover:
label: Header Bild
info: "alt: {{ file.alt }}" # changed this too
type: files
layout: cards
image:
ratio: 16/9
cover: false
multiple: false
# the code below made the difference
uploads:
template: default
Is there a list or a documentation of all the interactive “{{ variables }}” in the blueprints? So far I hardly understood some, but I don’t feel like, I know, what’s possible.
The general introduction to the query language is here: Query Language | Kirby CMS
For more complicated queries, you can usually create custom page, user, site etc. methods
1 Like
Hi there,
I think, I got more familiar with the query language now, but one question is still open.
How can I check, if the titleImage is filled or empty? Is this possible without a custom method?
name: Step
# check, if titleImage is filled?
label: "{{ title }} {{ titleImage.isNotEmpty }}"
fields:
title:
type: text
label: title
titleImage:
type: files
info: "alt: {{ file.alt }}"
layout: cards
multiple: false
uploads:
template: default
That looks like a custom block blueprint?
The label here doesn’t use the query language (looks the same but is different)! This is just a string template where you can use fieldnames.