Skip to content

Instantly share code, notes, and snippets.

@rdallaire
Created October 6, 2012 00:12
Show Gist options
  • Save rdallaire/3843183 to your computer and use it in GitHub Desktop.
Save rdallaire/3843183 to your computer and use it in GitHub Desktop.
Common liquid snippets
These snippets are to included right before the </body> tag:
- Mouse-Chaser Reference ––
{{ site.mouse_chaser }}
- High-Slide Reference ––
<div id="highslide-container"></div>
<div id="controlbar" class="highslide-overlay controlbar">
<a href="javascript:void(0)" onclick="return hs.previous(this)" title="Previous (left arrow key)"></a>
<a href="javascript:void(0)" onclick="return hs.next(this)" title="Next (right arrow key)"></a>
<a href="javascript:void(0)" class="highslide-move" title="Click and drag to move" style="margin-left: 10px"></a>
<a href="javascript:void(0)" onclick="hs.close(this)" title="Click to close"></a>
</div>
<!-- Banner automation -->
{ if current_date.month > 7 or current_date.month == 7 and current_date.day >= 13 } ORDER NOW BANNER HERE
{ else } PRE ORDER BANNER HERE
{ endif }
If you absolutely needed to include year, you’d have some redundancies:
{ if current_date.year 2012 %} {% if current_date.month > 7 or current_date.month 7 and current_date.day >= 13 } ORDER NOW BANNER HERE { else } PRE-ORDER BANNER HERE { endif }
{ elsif current_date.year > 2012 } ORDER NOW BANNER HERE
{ else } PRE-ORDER BANNER HERE
{ endif }
{% if site.buylist_mode? %}
<div id="selling">
<p><span>You are currently browsing to sell us cards.</span><br />
Click <a href="/buylists/stop_selling">here</a> to return to buying cards from us.<br />
</div>
{% endif %}
{% include 'category_tree' %}
{% if current_customer.logged_in? %}
<ul>
<li>{{ current_customer.fullname }}</li>
<li><a href="/user/wishlist">Wishlist</a></li>
<li><a href="">Refer A Friend</a></li>
<li><a href="/user/orders">Orders</a></li>
<li><a href="/user/change_password">Account</a></li>
<li><a href="/user/home">Change Password</a></li>
<li><a href="/user/logout">Log Out</a></li>
</ul>
{% else %}
<ul>
<li><a href="/user/signup">Register</a></li>
<li><a href="/user/login">Login</a></li>
</ul>
{% endif %}
<!-- Show something based on category name -->
{% if product.category.name == "Category Name" %}
FOR ALL PRODUCTS IN THE CATEGORY CALLED "CATEGORY NAME" DISPLAY THIS INFORMATION
{% else %}
FOR ALL OTHER PRODUCTS DISPLAY THIS INFORMATION
{% endif %}
<!-- We went with this approach because calling out by category.name, we have
a more reliable way of defining the statement. This can be applied for different
products with the use of {% elsif %} statement.
-->
<!-- for specific pages based on the page name -->
{% if site.pagename == "home" or site.pagename == "welcome" %}
<!-- place content and things you want here on the home or welcome pages -->
{% else %}
{{ content_for_layout }}
{% endif %}
<div id="quick_cart">
{% include "quick_cart" with order %}
</div>
<script language="javascript" type="text/javascript">
jQuery(document).ready(function() {
setupCategoryTree();
showCategory({{ current_category.id }});
markCurrentItem({{ current_category.id }});
//showCategory(123);
facebox = new Facebox();
});
</script>
<title>ClientName - {{ site.extra_title }}</title>
@rdallaire
Copy link
Author

{ if current_date.month > 7 or current_date.month == 7 and current_date.day >= 13 } ORDER NOW BANNER HERE
{ else } PRE ORDER BANNER HERE
{ endif }

If you absolutely needed to include year, you’d have some redundancies:

{ if current_date.year 2012 %} {% if current_date.month > 7 or current_date.month 7 and current_date.day >= 13 } ORDER NOW BANNER HERE { else } PRE-ORDER BANNER HERE { endif }
{ elsif current_date.year > 2012 } ORDER NOW BANNER HERE
{ else } PRE-ORDER BANNER HERE
{ endif }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment