Link

From Shopify Wiki

Jump to: navigation, search

Syntax:

{{ link.title | link_to: link.url }}


In this example we output the link's description and link it (thanks to the link_to filter) to its url.

The liquid variable link has the following attributes:

Contents

link.title

Returns the description of this link

link.url

Returns the url of this link

link.object

Returns the object that the link points to (A collection, product, etc).

Some people use this feature successfully for creating overviews for related collections:

{% for link in linklists.gift-ideas.links %} 
   <div>
   {{ link.object.products.first.image | product_image | link_to: link.object.url }} <br />
   {{ link.title }} 
   </div>
{% endfor %}

link.type

Returns the type of the object in link.object

Personal tools