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

Excursionist
32 0 1

@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
Excursionist
32 0 1

@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
Shopify Partner
565 122 184

@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
Excursionist
32 0 1

@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
565 122 184

@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
0 Likes