FROM CACHE - en_header

Split Object Inside of Article Object

Drew15
Shopify Expert
14 0 2

Not even sure how to describe my issue but I have run in to it before and couldn't resolve it so I have avoided it since. Hoping to get the solution here in writing. 

I have a split description. {{ product_description[2] }} is the articles url. It shows what it needs to elsewhere, but once it goes inside article object it all falls apart. 

{% assign article = articles['{{ product_description[2] }}'] %}

Also if I replace the {{ product_description[2] }} inside the article object with the article url handle everything works nicely.

Sure it is a simple syntax issue but would love to know the answer once and for all. 

Any help is greatly appreciated. 

 

Replies 2 (2)
Jason
Shopify Expert
10921 193 2198

You can't nest fiters like that. Not sure of the complete usage but looking at your code above I'd expect this approach:

{% assign articleHandle = product_description[2] | strip %}
{% assign article = articles[articleHandle] %}

Added the strip in as well to help catch any whitespace that might be in your string.

★ I jump on these forums in my free time to help and share some insights. Not looking to be hired, and not looking for work. http://freakdesign.com.au ★
Drew15
Shopify Expert
14 0 2

Jason, 

Worked like a charm.

You're always coming through with the simple answers. Thank you for this response and all the others you've made out there that have helped me in the past.