LIQUID Templating language information

Liquid which allows our customers complete design freedom while maintaining the integrity of our servers.

Shopify Theme Guide - great place to start, and get an understanding of what is, and how its

Liquid for Designers  - great reference (bookmark it if you are working with themes :)

Menumill Suppport - support forums, FAQ's and KnowledgeBase

 

LIQUID FILTERS & TAGS

global_image_tag(input, alt="")
- image tag in global directory

global_javascript(input)
- javascript tag in global directory

global_stylesheet(input, media="all")
- stylesheet tag in global

img_tag(url, alt="")
- image tag
{{ "logo.png" | asset_url | img_tag }}
 

javascript(url)
- javascript tag
{{ 'prototype.js' | asset_url | javascript }}

stylesheet(url, media="all")
- stylesheet tag
{{ 'style.css' | asset_url | stylesheet }}

link_to(link, url, *args)
- link a href tag
{{ link.title | link_to: link.url }}

asset_url(input)
- url of theme asset file
{{ 'style.css' | asset_url }}

stylesheet_tag(url, media="all")
- stylesheet tag
{{ 'style.css' | asset_url | stylesheet_tag }}

script_tag(url)
- script tag
{{ 'jquery-1.3.2.min.js' | asset_url | script_tag }}

content_block(name)
- render named content block
{{ "main" | content_block }}

site_content_block(name)
- render named site content blcok
{{ "info" | site_content_block }}

money(amount)
- formats number to 2 decimal places, and strips .00 (so 2.00 renders as 2)
{{ variant.price | money }}

money_without_currency
- formats number to 2 decimal places, without currency symbol
{{ variant.price | money_without_currency }}

assign_to(value, name)
- assign liquid variable, example usage:
{{ 'tutorials' | section | assign_to: 'tutorials' }}

date(date, format)
- calls strftime with format options
{{ article.created_at | date: "%B %d, %Y" }} generates: 

link_to_page(page, *args)
- args are href options

link_to_unless_current(link, url, *args)
- creates a link unless the current url is the url passed in to the filter
{{ article.title | link_to_unless_current: article.url }}

nav_link(link, *args)
- useful for rendering navigation tree/heirarchy
- marks ancestors with selected class
- supports linking to its first child
** needs some examples here **

nav_link_to_unless_current(link, *args)
- same as nav_link (above) but it does not link if current url

event_img_url(asset, size = 'small')
gallery_img_url(asset, size = 'small')
- default size is small if not passed
- size options: 'pico', 'icon', 'thumb', 'square', 'small', 'medium', 'large', 'original'
example usage:

{% for image in galleries.test-gallery.images %}
{{ image | gallery_img_url: 'square' | img_tag: image.alt }}
{% endfor %}

 

favicon:
<link rel="shortcut icon" type="image/x-icon" href="{{ 'favicon.ico' | asset_url }}" />

meta tags - more info
{{ site.default_meta_description | meta_description_tag }}
{{ site.default_meta_keywords | meta_keywords_tag }}

--------------------------

VARIABLES/OBJECTS

site:
title
meta_description - TODO
homepage
root_pages
root_links
pages
handles
upcoming_events
previous_events
menus - collection of active menus
galleries - collection of active galleries

asset:
url(size = 'small'): gets the url of the requested size for the asset
- valid sizes: 'pico', 'icon', 'thumb', 'square', 'small', 'medium', 'large', 'original'
alt: alt tag

events.event_name
- looks up event by handle

event:
title
handle
url
summary
cost
body
starts_at
ends_at
formatted_date: example Thursday, January 24, 2008 - Sunday, January 27, 2008
formatted_time: example 5:30 pm - 7 pm
formatted_date_time: example Thursday, January 24, 2008 - Sunday, January 27, 2008 5:30 pm - 7 pm
images - collection
featured_image

galleries.gallery_name
- looks up gallery by handle

gallery:
name
url
description
images - collection
featured_image

linklists.list_name
- looks up linklist by handle

linklist:
name
links - collection of links

link:
title
url
submenu - boolean. If true, it links to its first child link.
breadcrumbs - collection of ancestors links (reversed)
ancestors - collection of ancestors
children - list of children
parent - parent link
type - type of object this links to.  I.e. Page, Menu, Event, Gallery, Blog, external_url, etc
object - object that the link is linking to if its a Page, Menu, Event, Gallery, Blog

pages.page_name
- looks up page by handle

page:
title
label - if the label is blank, then it returns the title
handle
url
block_body(name) - lookup named content block for page
blocks
template

menus.menu_name
- lookup menu by handle

menu:
name
url
description
sections - collection of sections

section:
name
description
items - collection of items

item:
name
description
price
price_alt
images - collection
featured_image

blogs.blog_name
- lookup blog by handle name

blog:
title
handle
url
articles
articles_count

article:
title
handle
url
summary
body
created_at
author

 

GLOBALS

current_url:
- returns the current url, useful for comparing in navigation structures etc

current_link:
- set if the current url/handle is in the site navigation, so we know where we are in the navigation structure

page_title:
- title that can be used in the template, if its a menu its the menu name. if a gallery, its the gallery name etc.