Difference between revisions of "Liquid Template Variables - link"

From Spiffy Stores Knowledge Base

Line 31: Line 31:
  
 
Returns the type of the object in link.object.
 
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
  
 
== <code>link.links</code> ==
 
== <code>link.links</code> ==

Revision as of 15:14, 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 %}

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.