Skip to content

liquid_markups_output

Vladimir Krõlov edited this page Jul 24, 2014 · 3 revisions

Markup outputs

Calling variable

{{variable}} or {{variable.variable_method}}

Example

{{categories['pluusid'].url}}

Layout content

Should be set into file layout.liquid to render view like index.liquid, product.liquid and so on. {{ content_for_layout }}

Translation

{{ "string" | t}} or {{"string" | translate}} 

They are equalents and return both the same result. Translation will be taken from files trasltions/lang.json.

Example:

{{ 'frontpage.hero.cta' | t}}

Assets

Asset is datatype which is connected to the theme and is fetched by browser separately. For example, stylesheet, javascript or image. Once you set it this way we will handle them dynamically.

{{ "filename" | asset_url }}

Example

{{ 'frontpage-3.jpg' | asset_url | image_tag }}

Icon

Is used for fetching favicon. By default it is favicon.ico. If browser fetches this icon and it is not provided we will provide it for you.

{{ "favicon.ico"  | asset_url | icon_tag }}

Image

Generates tag.

{{"image.jpg" |image_tag }}

Example:

{{ 'frontpage-3.jpg' | asset_url | image_tag }}

Stylesheets

Generates stylesheet tag

{{ "style.css" | stylesheet_tag }}

Example:

{{ "style.css" | asset_url | stylesheet_tag }}

Javascript

Generates javascript tag

{{ "javascript.js" | javascript_tag }}

Example:

{{ "custom.modernizr.js" | asset_url | javascript_tag }}

Money

{{ price | money}}

Example:

{{ item.total | money }}

Escape

{{ "dsdsd ds <>" | escape }}

Others

{{33 |weight_with_unit}}
{{"text" | strip_html}}
{{"big text" | truncate: 2 }}

For pagination

Is used to set custom buttons for previouts and next pages and is called inside pagination block.Just giving an example:

{{ paginate | default_pagination }}
or
{{ paginate | default_pagination: 'prev:<span class="icon-left"></span>', 'next:<span class="icon-right"></span>' }}

Locale

{{locale}} returns current locale

Links

{{ category | link_to_category }} - to category link