Solved

Dynamics icon_url

  • 24 September 2021
  • 1 reply
  • 44 views

Hi, is it possible to create a dynamic iron_url?

I’m using the link parameter and for the icon_url I wanted to create a conditional statement.

For example: Let’s say that sources are social medias.

If ${sources} = A, then bring the icon from A, else if ${sources} = B, then bring the icon from B.

My first idea was defining a dimension using HTML parameter using liquid conditional statements and then referencing it in the icon_url, but it didn’t work.

 

 

 

icon

Best answer by sarah.tayeri 24 September 2021, 18:42

View original

This topic has been closed for comments

1 reply

Userlevel 1

Hey Vinicius, very cool use case to have a dynamic icon_url! 

You can use liquid variables in the icon_url parameter to achieve this, namely a liquid {% if %} evaluator and ._value. 

For example: 

icon_url: 
"{% if order_items.status._value == 'Complete' %}
https://logo-core.clearbit.com/looker.com
{% else %}
https://logo-core.clearbit.com/google.com
{% endif %}"

This will display Looker’s logo when order_items.status = Complete, and Google’s logo otherwise.