Help me output within output {{ pages.{{ product.tags.first }}.content }}

Highlighted
Explorer
63 0 3

@Tejas_Nadpara 

 

Yes - The collection handle is "abc" and page handle is "abc", same as the titles. So www.my-website.com/collections/abc and /pages/abc...

 

Hoping this makes sense!

0 Likes
Highlighted
Explorer
63 0 3

@Tejas_Nadpara 

 

For further clarification, and hopefully not to confuse you more - another way to think about it is I could accomplish this task by creating this code on the product-card-list:

{% if product.tags.first contains "abc" %}
<a href="https://my-website/collections/abc">{{ pages.abc.content }}</a>
{% endif %}

However, to make it easier for me, since product.tags.first (abc) is the same as the collection and page handles, something like this would be easier and more efficient than me creating unique code for each product.tags.first...but it doesn't work at the moment:

{% assign tag =  product.tags.first %} 
<a href="https://my-website/collections/{{tag}}">{{ page[tag].content }}</a>

 

0 Likes
Highlighted
Shopify Partner
576 124 195

@tesstesting 

 

Can you send me the output of the following code?

{% assign tag =  product.tags.first | strip %} 
<a href="https://my-website/collections/{{tag}}">{{ pages[tag].content }}</a>
Shopify Expert | Skype: tejas.nadpara
- Like and Mark as an Accepted Solution if reply helpful
- Feel free to contact me on support@hexaecommerce.com regarding any help
1 Like
Highlighted
Explorer
63 0 3

@Tejas_Nadpara 

 

Hi! So I tried your code, double checked all handles and titles and tags but unfortunately it outputs nothing.

This seems to be there where things go wrong: 

{{ pages[tag].content }}

That said, I do have a workaround for this by creating snippets for each page (pages.abc1.content...pages.abc2.content...) so I'm just going to go with that unless you think of a solution! Thanks for all your help with this issue!

0 Likes
Shopify Partner
576 124 195

@tesstesting 

 

I think there is some mistake in assigning tag value. Print only tag value and let me know is it returns the correct tag value?

<a href="https://my-website/collections/{{tag}}">{{tag}}</a>
Shopify Expert | Skype: tejas.nadpara
- Like and Mark as an Accepted Solution if reply helpful
- Feel free to contact me on support@hexaecommerce.com regarding any help
1 Like
Highlighted
Explorer
63 0 3

@Tejas_Nadpara 

 


I think there is some mistake in assigning tag value. Print only tag value and let me know is it returns the correct tag value?

<a href="https://my-website/collections/{{tag}}">{{tag}}</a>

Yes, this does print the correct tag...to be continued I guess?

0 Likes
Highlighted
Shopify Partner
576 124 195

@tesstesting 

 

Okay, It's difficult to check exact issue without debug code but let's try this last code:

{% capture tag %}{{product.tags.first | strip }}{% endcapture %} 
<a href="https://my-website/collections/{{tag}}">{{ pages[tag].content }}</a>
Shopify Expert | Skype: tejas.nadpara
- Like and Mark as an Accepted Solution if reply helpful
- Feel free to contact me on support@hexaecommerce.com regarding any help
1 Like
Highlighted
Explorer
63 0 3

@Tejas_Nadpara 

 

It didn't work for me but I'm sure it'll work for someone else, something may be off in my code. I just went ahead and created the snippets I needed. It wasn't as efficient as this was in theory but it worked great for me. Thank you so much again for helping me address this issue!

0 Likes