Difference between revisions of "Liquid Variable Reference"

From Spiffy Stores Knowledge Base

(New page: 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 Followin...)
 
Line 1: Line 1:
 
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.
 
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
+
== Requirements ==
  
 
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}}
+
* {{content_for_header}}
    * {{content_for_layout}}
+
* {{content_for_layout}}
  
 
+
== Template specific objects ==
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.
 
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
+
=== 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.
 
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.
Line 21: Line 20:
 
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.
 
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
+
=== product.liquid ===
  
 
The referenced product with several variants.
 
The referenced product with several variants.
  
blog.liquid
+
=== blog.liquid ===
  
 
blog which has several article objects.
 
blog which has several article objects.
  
collection.liquid
+
=== collection.liquid ===
  
 
collection which references several product and tags objects. Collections usually make use of pagination.
 
collection which references several product and tags objects. Collections usually make use of pagination.
  
page.liquid
+
=== page.liquid ===
  
 
page
 
page
  
cart.liquid
+
=== cart.liquid ===
  
 
cart with many line_items
 
cart with many line_items
  
Global objects
+
== Global objects ==
  
 
Following objects are available from any liquid template in the system. You can use those
 
Following objects are available from any liquid template in the system. You can use those

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.

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