mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-18 10:20:43 -07:00
Re-organizing basics content, starting to remove Shopify-specific content
This commit is contained in:
+3
-10
@@ -2,16 +2,9 @@
|
||||
title: Handles
|
||||
---
|
||||
|
||||
# Handles
|
||||
### What is a handle
|
||||
|
||||
|
||||
<a id="topofpage"></a>
|
||||
|
||||
|
||||
|
||||
## What is a handle
|
||||
|
||||
The handle is used to access the attributes of a Liquid object. By default, it is the object's title in lowercase with any spaces and special characters replaced by hyphens (-). Every object in Liquid (product, collection, blog, link list) has a handle.
|
||||
The handle is used to access the attributes of a Liquid object. By default, it is the object's title in lowercase with any spaces and special characters replaced by hyphens (-).
|
||||
|
||||
For example, a page with the title "About Us" can be accessed in Liquid via its handle <tt>about-us</tt> as shown below:
|
||||
|
||||
@@ -20,7 +13,7 @@ For example, a page with the title "About Us" can be accessed in Liquid via its
|
||||
{{ pages.about-us.content }}
|
||||
{% endraw %}{% endhighlight %}
|
||||
|
||||
## How are my handles created?
|
||||
### How are my handles created?
|
||||
|
||||
A product with the title "Shirt" will automatically be given the handle **shirt**. If there is already a product with the handle "Shirt", the handle will auto-increment. In other words, all "Shirt" products created after the first one will receive the handle **shirt-1**, **shirt-2**, and so on.
|
||||
|
||||
|
||||
@@ -2,14 +2,9 @@
|
||||
title: Operators
|
||||
---
|
||||
|
||||
# Operators
|
||||
Liquid has access to all of the logical and comparison operators.
|
||||
|
||||
<a id="topofpage"></a>
|
||||
|
||||
Liquid has access to all of the logical and comparison operators. These can be used in tags such as <a href="/themes/liquid-documentation/tags/control-flow-tags/#if">if</a> and <a href="/themes/liquid-documentation/tags/control-flow-tags/#unless">unless</a>.
|
||||
|
||||
|
||||
## Basic Operators
|
||||
### Basic Operators
|
||||
|
||||
<table>
|
||||
<tbody>
|
||||
@@ -77,7 +72,7 @@ Operators can be chained together.
|
||||
|
||||
|
||||
|
||||
## Contains operator
|
||||
### Contains operator
|
||||
|
||||
<code>contains</code> checks for the presence of a substring inside a string.
|
||||
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
---
|
||||
title: Basics
|
||||
---
|
||||
|
||||
|
||||
# Introduction
|
||||
|
||||
Liquid is an open-source, Ruby-based template language created by Shopify. It is the backbone of Shopify themes and is used to load dynamic content on storefronts.
|
||||
|
||||
<iframe width="560" height="315" src="//www.youtube.com/embed/tZLTExLukSg" frameborder="0" allowfullscreen style="margin: 0 auto 24px auto; width: 70%; display: block; padding: 20px 15%; background: #f9f9f9;"></iframe>
|
||||
|
||||
Liquid uses a combination of _tags_, _objects_, and _filters_ to load dynamic content. They are used inside Liquid _template files_, which are a group of files that make up a theme. For more information on the available templates, please see <a href="/themes/theme-development/templates/">Theme Development</a>.
|
||||
|
||||
## Tags
|
||||
|
||||
Tags make up the programming logic that tells templates what to do.
|
||||
|
||||
{% raw %}
|
||||
{% if user.name == 'elvis' %}
|
||||
Hey Elvis
|
||||
{% endif %}
|
||||
{% endraw %}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Filters
|
||||
|
||||
Filters are used to modify the output of strings, numbers, variables, and objects.
|
||||
|
||||
{% raw %}
|
||||
{{ 'sales' | append: '.jpg' }} <!-- Output: sales.jpg -->
|
||||
{% endraw %}
|
||||
<p class="tr">
|
||||
<a class="themes-article-cta" href="/themes/liquid-documentation/filters">Read more ›</a>
|
||||
</p>
|
||||
@@ -2,10 +2,6 @@
|
||||
title: Truthy and Falsy
|
||||
---
|
||||
|
||||
# Truthy and Falsy in Liquid
|
||||
|
||||
|
||||
|
||||
In programming, we describe “truthy” and “falsy” as anything that returns true or false, respectively, when used inside an if statement.
|
||||
|
||||
## What is truthy?
|
||||
|
||||
Reference in New Issue
Block a user