Separate by comma on shortcode call

hello!

I’m trying to add a small country-selector to a small shortcode I’m working on.

{{<  book country="US, UK, CA" >}}

is there any way of checking against that?

Kind of:

{{ if eq (.Get "country") "UK" }}

something

{{ end }}

I don’t want to do the usual {{< book us="yes" uk="no" ca="no" >}} because I’m using like 10 countries, not just these three.

1 Like

or use arrays

{{< book country=[“US”, “UK”, “CA”] >}}

the you can use the in function ( see above)

{{ if in (.Get "country") "UK" }}

works for you

Sir, you are a savior. THANK YOU. I honestly spend the entire night of last night looking for a way of doing this and I missed the “in” function. I guess I am not “in” enough.