Difference between revisions of "Liquid Template Variables - link"

From Spiffy Stores Knowledge Base

Line 27: Line 27:
 
</div>
 
</div>
 
{% endfor %}</pre>
 
{% endfor %}</pre>
 +
 +
An object is not returned if the object type is ''frontpage_link'', ''search_link'' or ''http_link''.
  
 
== <code>link.type</code> ==
 
== <code>link.type</code> ==

Revision as of 15:16, 16 September 2008

The liquid template variable link has the following attributes:

link.id

Returns the unique internal number of the link.

This is normally only for internal usage.

link.title

Returns the title of this link.

link.url

The is the link's relative URL address.

link.object

Returns the object that the link points to, for example, a collection, a product, and so on.

This could be used to create an overview 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 %}

An object is not returned if the object type is frontpage_link, search_link or http_link.

link.type

Returns the type of the object in link.object.

The values returned are as follows:

  • frontpage_link
  • product_link
  • collection_link
  • page_link
  • blog_link
  • search_link
  • http_link

link.links

Returns a collection of all of this link's children.

link.links_count

Returns the number of child links for this link.