Difference between revisions of "Liquid Template Variables - template"
From Spiffy Stores Knowledge Base
(New page: The '''template''' variable returns the current template type. For example in the '''blog.liquid''' file, the template type is ''blog''. The '''product.liquid''' template returns the typ...) |
|||
Line 4: | Line 4: | ||
The '''product.liquid''' template returns the type ''product''. | The '''product.liquid''' template returns the type ''product''. | ||
+ | |||
+ | For example, you can specify different layout options depending upon which template is being rendered. | ||
+ | |||
+ | <pre></ul>{% if template == 'index' %} | ||
+ | <span class="sidebar-title">latest news</span> | ||
+ | <ul id="latest-news">{% for article in blogs.frontpage.articles limit: 6 %} | ||
+ | <li> | ||
+ | <a href="{{ article.url }}">{{ article.title | strip_html }}</a> | ||
+ | <br/>{{ article.content | strip_html | truncate: 70 }}{% endfor %} | ||
+ | </li> | ||
+ | </ul>{% else %}...</pre> |
Revision as of 14:02, 3 August 2008
The template variable returns the current template type.
For example in the blog.liquid file, the template type is blog.
The product.liquid template returns the type product.
For example, you can specify different layout options depending upon which template is being rendered.
</ul>{% if template == 'index' %} <span class="sidebar-title">latest news</span> <ul id="latest-news">{% for article in blogs.frontpage.articles limit: 6 %} <li> <a href="{{ article.url }}">{{ article.title | strip_html }}</a> <br/>{{ article.content | strip_html | truncate: 70 }}{% endfor %} </li> </ul>{% else %}...