How can I create a button that only appears when a block setting isn't empty?

I am trying to add a button to my site that only appears IF the block setting is not empty.

I need help with the IF statement. I can not figure out how to build it out.

any comments would be helpful.

Hi @DavidCab ,

You have to put this code inside the {% for block in block.settings %} if you are calling the block. You need to add a name of the block setting.

You can use this logic.

{% if block.settings.myblock != blank %}

{% endif %}

Then under your {% schema %}, find the “blocks: [”, under the “settings: [” add the code below.

{
"type": "text",
"id": "myblock",
"label": "My block"
},