I am creating meta fields and want certain words to be bold in the meta fields descriptions. I have inserted the following code:
{% if block.settings.heading contains 'Ingredients' %}
{% assign beatles = block.settings.content | split: "|" %}
{% for member in beatles %}
{% assign value = forloop.index | modulo:2 %}
{% if value != 0 %}
{{ member }}<b>
{% else %}
{{ member }}
</b> {% endif %}
{% endfor %}
{% else %}
{{ block.settings.content }}
{% endif %}
It works so far, but only for the meta field “Ingredients” but not for the other meta fields. Does anyone have an idea how I can set this up for all metafields and not only for one metafield (“Ingredients”)?
Thank you for your help. Unfortunately it doesn’t work, maybe my description was a bit misleading. I have several meta fields (e.x. Ingredients, storage, etc.) In this metafields I’d like to make some words bold, but not all of them. I want to mark the words I want to make bold with “|” e.x. “|wheat|”. The code I posted seems to work, but only for the Metafield “Ingredients” and not for all the other metafields like e.x. “storage”. Do you have an idea of a code, so that the solution with “|” works for all metafields and not only for the metafield “Ingredients”?