Difference between revisions of "Index.liquid"

From Spiffy Stores Knowledge Base

Line 38: Line 38:
 
== Variables ==
 
== Variables ==
  
There are no additional variables for the index.liquid template. All global variables are available.
+
There are no additional variables for the index.liquid template. All [[Liquid Variable Reference#Global objects|global variables]] are available.

Revision as of 17:56, 1 September 2008

Index.liquid

This is the home page for your store. You will want to use this page to highlight information about your store and any featured products or offers that you want to promote.

The following code shows a sample index page which displays the content from the home-page page, and then displays all the products in the home-page collection.

<div class="textile">
  {{ pages.home-page.content }}
</div>
<h2>Our best sellers...</h2>
{% if collections.home-page.products.size > 0 %}
<table id="products" cellspacing="0" cellpadding="0">
  {% tablerow product in collections.home-page.products cols: 4 limit: 12 %}
  <div class="product">
    <a href="{{ product.url }}" onClick="document.location = '{{ product.url }}'">
      <div class="product-image-container">
	<div class="product-image">
	  {% capture product_title %}{{ product.title | escape }}{% endcapture %}
	  {{ product.featured_image | product_img_url: 'small' | img_tag: product_title }}
	</div>
      </div>
      <h3>{{ product.title | truncate: 42, '...'}}</h3>
      <br />
      <div class="money">
	{% if product.price_min != product.price_max %}
	  From {{ product.price_min | money }}
	{% else %}
	  Only {{ product.price | money }}
	{% endif %}
      </div>
    </a>
  </div>
  {% endtablerow %}
</table>
{% endif %}

Variables

There are no additional variables for the index.liquid template. All global variables are available.