Difference between revisions of "Liquid Variable Reference"

From Spiffy Stores Knowledge Base

Line 5: Line 5:
 
Following variables have to be included in every liquid theme file such as the theme.liquid.
 
Following variables have to be included in every liquid theme file such as the theme.liquid.
  
* {{content_for_header}}
+
* <pre>{{content_for_header}}</pre>
* {{content_for_layout}}
+
* <pre>{{content_for_layout}}</pre>
  
 
== Template specific objects ==
 
== Template specific objects ==

Revision as of 18:22, 15 May 2008

Following is a reference-list of objects which you can use in your liquid templates. For a introduction to liquid templates you can check out the UsingLiquid page.

Requirements

Following variables have to be included in every liquid theme file such as the theme.liquid.

  • {{content_for_header}}
  • {{content_for_layout}}

Template specific objects

Special purpose templates usually export the object they reference by the same name as the template file. Product.liquid, for example, would export a product object which references the current product on the page.

index.liquid

This template creates your Shop's frontpage. Its not directly related to any given resource of your Shop in the same way that product.liquid is.

Because of this index.liquid designers usually make use of the global objects referenced below. You are free to use any objects (product, collection, page etc.) in your store from here.

By convention the default themes will render all articles of a blog with handle frontpage if it exist and display products from a collection with handle frontpage. Both those objects are created automatically during the Shopify signup for convenience.

product.liquid

The referenced product with several variants.

blog.liquid

blog which has several article objects.

collection.liquid

collection which references several product and tags objects. Collections usually make use of pagination.

page.liquid

page

cart.liquid

cart with many line_items

Global objects

Following objects are available from any liquid template in the system. You can use those

   * cart
   * collections
   * linklists
   * pages
   * blogs
   * shop
   * template