diff --git a/_basics/introduction.md b/_basics/introduction.md index 639bb64c..101affcf 100644 --- a/_basics/introduction.md +++ b/_basics/introduction.md @@ -4,11 +4,11 @@ description: An overview of objects, tags, and filters in the Liquid template la redirect_from: /basics/ --- -Liquid code can be categorized into [**objects**](#objects), [**tags**](#tags), and [**filters**](#filters). +Liquid uses a combination of [**objects**](#objects), [**tags**](#tags), and [**filters**](#filters) inside **template files** to display dynamic content. ## Objects -**Objects** tell Liquid where to show content on a page. Objects and variable names are denoted by double curly braces: `{% raw %}{{{% endraw %}` and `{% raw %}}}{% endraw %}`. +**Objects** contain the content that Liquid displays on a page. Objects and variables are displayed when enclosed in double curly braces: `{% raw %}{{{% endraw %}` and `{% raw %}}}{% endraw %}`.
Input
```liquid @@ -26,9 +26,7 @@ In this case, Liquid is rendering the content of the `title` property of the `pa ## Tags -**Tags** create the logic and control flow for templates. They are denoted by curly braces and percent signs: `{% raw %}{%{% endraw %}` and `{% raw %}%}{% endraw %}`. - -The markup used in tags does not produce any visible text. This means that you can assign variables and create conditions and loops without showing any of the Liquid logic on the page. +**Tags** create the logic and control flow for templates. The curly brace percentage delimiters `{% raw %}{%{% endraw %}` and `{% raw %}%}{% endraw %}` and the text that they surround do not produce any visible output when the template is rendered. This lets you assign variables and create conditions or loops without showing any of the Liquid logic on the page.Input
```liquid @@ -44,11 +42,11 @@ The markup used in tags does not produce any visible text. This means that you c Hello Adam! ``` -Tags can be categorized into three types: +Tags can be categorized into various types: - [Control flow]({{ "/tags/control-flow/" | prepend: site.baseurl }}) - [Iteration]({{ "/tags/iteration/" | prepend: site.baseurl }}) -- [Variable assignments]({{ "/tags/variable/" | prepend: site.baseurl }}) +- [Variable assignment]({{ "/tags/variable/" | prepend: site.baseurl }}) You can read more about each type of tag in their respective sections. @@ -68,7 +66,7 @@ You can read more about each type of tag in their respective sections. {{ "/my/fancy/url" | append: ".html" }} ``` -Multiple filters can be used on one output. They are applied from left to right. +Multiple filters can be used on one output, and are applied from left to right.Input
```liquid diff --git a/_basics/operators.md b/_basics/operators.md index 0f945cfe..05e17596 100644 --- a/_basics/operators.md +++ b/_basics/operators.md @@ -3,7 +3,7 @@ title: Operators description: Using operators to perform calculations in the Liquid template language. --- -Liquid includes many logical and comparison operators. +Liquid includes many logical and comparison operators. You can use operators to create logic with [control flow]({{ "/tags/control-flow/" | prepend: site.baseurl }}) tags. ## Basic operators @@ -54,7 +54,7 @@ For example: {% endraw %} ``` -You can use multiple operators in a tag: +You can do multiple comparisons in a tag using the `and` and `or` operators: ```liquid {% raw %} diff --git a/_basics/truthy-and-falsy.md b/_basics/truthy-and-falsy.md index 5703691d..cc367f0d 100644 --- a/_basics/truthy-and-falsy.md +++ b/_basics/truthy-and-falsy.md @@ -3,11 +3,7 @@ title: Truthy and falsy description: An overview of boolean logic in the Liquid template language. --- -In programming, anything that returns `true` in a conditional is called **truthy**. Anything that returns `false` in a conditional is called **falsy**. All object types can be described as either truthy or falsy. - -- [Truthy](#truthy) -- [Falsy](#falsy) -- [Summary](#summary) +When a non-boolean [data type]({{ "/basics/types/" | prepend: site.baseurl }}) is used in a boolean context (such as a conditional tag), Liquid decides whether to evaluate it as `true` or `false`. Data types that return `true` by default are called **truthy**. Data types that return false by default are called **falsy**. ## Truthy @@ -43,7 +39,7 @@ In the example below, the text "Tobi" is not a boolean, but it is truthy in a co ## Falsy -The falsy values in Liquid are [`nil`]({{ "/basics/types/#nil" | prepend: site.baseurl }}) and [`false`]({{ "/basics/types/#boolean" | prepend: site.baseurl }}). +The only values that are falsy in Liquid are [`nil`]({{ "/basics/types/#nil" | prepend: site.baseurl }}) and [`false`]({{ "/basics/types/#boolean" | prepend: site.baseurl }}). ## Summary diff --git a/_basics/types.md b/_basics/types.md index 84bdc342..6ec4e8c3 100644 --- a/_basics/types.md +++ b/_basics/types.md @@ -12,11 +12,11 @@ Liquid objects can be one of six types: - [Array](#array) - [EmptyDrop](#emptydrop) -You can initialize Liquid variables with the [assign]({{ "/tags/variable/#assign" | prepend: site.baseurl }}) or [capture]({{ "/tags/variable/#capture" | prepend: site.baseurl }}) tags. +You can initialize Liquid variables using [`assign`]({{ "/tags/variable/#assign" | prepend: site.baseurl }}) or [`capture`]({{ "/tags/variable/#capture" | prepend: site.baseurl }}) tags. ## String -Declare a string by wrapping a variable's value in single or double quotes: +Strings are sequences of characters wrapped in single or double quotes: ```liquid {% raw %} @@ -24,6 +24,8 @@ Declare a string by wrapping a variable's value in single or double quotes: {% endraw %} ``` +Liquid does not convert escape sequences into special characters. + ## Number Numbers include floats and integers: @@ -124,7 +126,7 @@ Adam You cannot initialize arrays using only Liquid. -You can, however, use the [split]({{ "/filters/split/" | prepend: site.baseurl }}) filter to break a string into an array of substrings. +You can, however, use the [`split`]({{ "/filters/split/" | prepend: site.baseurl }}) filter to break a string into an array of substrings. ## EmptyDrop diff --git a/_filters/abs.md b/_filters/abs.md index 5fc06463..808551a7 100644 --- a/_filters/abs.md +++ b/_filters/abs.md @@ -20,7 +20,7 @@ Returns the absolute value of a number. {{ 4 | abs }} ``` -`abs` will also work on a string that only contains a number: +`abs` will also work on a string that only contains a number.Input
```liquid diff --git a/_filters/append.md b/_filters/append.md index 9c0bc162..f2073d85 100644 --- a/_filters/append.md +++ b/_filters/append.md @@ -3,7 +3,7 @@ title: append description: Liquid filter that appends a string to another string. --- -Concatenates two strings and returns the concatenated value. +Adds the specified string to the end of another string.Input
```liquid @@ -17,7 +17,7 @@ Concatenates two strings and returns the concatenated value. {{ "/my/fancy/url" | append: ".html" }} ``` -`append` can also be used with variables: +`append` can also accept a variable as its argument.Input
```liquid diff --git a/_filters/capitalize.md b/_filters/capitalize.md index 4fd0e76e..7fb1a493 100644 --- a/_filters/capitalize.md +++ b/_filters/capitalize.md @@ -17,7 +17,7 @@ Makes the first character of a string capitalized and converts the remaining cha {{ "title" | capitalize }} ``` -`capitalize` only capitalizes the first character of a string, so later words are not affected: +Only the first character of a string is capitalized, so later words are not capitalized:Input
```liquid diff --git a/_filters/ceil.md b/_filters/ceil.md index 825519fe..7dedd17f 100644 --- a/_filters/ceil.md +++ b/_filters/ceil.md @@ -3,7 +3,7 @@ title: ceil description: Liquid filter that returns the ceiling of a number by rounding up to the nearest integer. --- -Rounds the input up to the nearest whole number. Liquid tries to convert the input to a number before the filter is applied. +Rounds an input up to the nearest whole number. Liquid tries to convert the input to a number before the filter is applied.Input
```liquid diff --git a/_filters/concat.md b/_filters/concat.md index 18a9b447..3df9caaf 100644 --- a/_filters/concat.md +++ b/_filters/concat.md @@ -30,7 +30,7 @@ Concatenates (joins together) multiple arrays. The resulting array contains all - potatoes ``` -You can string together `concat` filters to join more than two arrays: +You can string together multiple `concat` filters to join more than two arrays.Input
```liquid diff --git a/_filters/date.md b/_filters/date.md index 69be3ec3..4b8a6124 100644 --- a/_filters/date.md +++ b/_filters/date.md @@ -29,7 +29,7 @@ Fri, Jul 17, 15 2015 ``` -`date` works on strings if they contain well-formatted dates: +`date` works on strings if they contain well-formatted dates.Input
```liquid @@ -43,7 +43,7 @@ Fri, Jul 17, 15 {{ "March 14, 2016" | date: "%b %d, %y" }} ``` -To get the current time, pass the special word `"now"` (or `"today"`) to `date`: +To get the current time, pass the special word `"now"` (or `"today"`) to `date`.Input
```liquid diff --git a/_filters/default.md b/_filters/default.md index 552fa5d2..123b12b3 100644 --- a/_filters/default.md +++ b/_filters/default.md @@ -3,7 +3,7 @@ title: default description: Liquid filter that specifies a fallback in case a value doesn't exist. --- -Allows you to specify a fallback in case a value doesn't exist. `default` will show its value if the left side is `nil`, `false`, or empty. +Sets a default value for any variable with no assigned value. `default` will show its value if the input is `nil`, `false`, or empty. In this example, `product_price` is not defined, so the default value is used. diff --git a/_filters/floor.md b/_filters/floor.md index c70a2234..90c5cf63 100644 --- a/_filters/floor.md +++ b/_filters/floor.md @@ -3,7 +3,7 @@ title: floor description: Liquid filter that returns the floor of a number by rounding down to the nearest integer. --- -Rounds the input down to the nearest whole number. Liquid tries to convert the input to a number before the filter is applied. +Rounds an input down to the nearest whole number. Liquid tries to convert the input to a number before the filter is applied.Input
```liquid diff --git a/_filters/lstrip.md b/_filters/lstrip.md index b2fd5a58..944118b2 100644 --- a/_filters/lstrip.md +++ b/_filters/lstrip.md @@ -3,7 +3,7 @@ title: lstrip description: Liquid filter that removes all whitespace from the left side of a string. --- -Removes all whitespace (tabs, spaces, and newlines) from the left side of a string. It does not affect spaces between words. +Removes all whitespace (tabs, spaces, and newlines) from the **left** side of a string. It does not affect spaces between words.Input
```liquid diff --git a/_filters/newline_to_br.md b/_filters/newline_to_br.md index 89b280d0..033c4d19 100644 --- a/_filters/newline_to_br.md +++ b/_filters/newline_to_br.md @@ -3,7 +3,7 @@ title: newline_to_br description: Liquid filter that converts newlines in a string to HTMLInput
```liquid diff --git a/_filters/prepend.md b/_filters/prepend.md index 5df4708b..ad6b362e 100644 --- a/_filters/prepend.md +++ b/_filters/prepend.md @@ -17,7 +17,7 @@ Adds the specified string to the beginning of another string. {{ "apples, oranges, and bananas" | prepend: "Some fruit: " }} ``` -`prepend` can also be used with variables: +`prepend` can also accept a variable as its argument.Input
```liquid diff --git a/_filters/reverse.md b/_filters/reverse.md index 3832f67c..4da95ca4 100644 --- a/_filters/reverse.md +++ b/_filters/reverse.md @@ -21,7 +21,7 @@ Reverses the order of the items in an array. `reverse` cannot reverse a string. {{ my_array | reverse | join: ", " }} ``` -Although `reverse` cannot be used directly on a string, you can split a string into an array, reverse the array, and rejoin it by chaining together filters: +Although `reverse` cannot be used directly on a string, you can split a string into an array, reverse the array, and rejoin it by chaining together filters.Input
```liquid diff --git a/_filters/rstrip.md b/_filters/rstrip.md index eb865744..99d913c5 100644 --- a/_filters/rstrip.md +++ b/_filters/rstrip.md @@ -3,7 +3,7 @@ title: rstrip description: Liquid filter that removes all whitespace from the right side of a string. --- -Removes all whitespace (tabs, spaces, and newlines) from the right side of a string. It does not affect spaces between words. +Removes all whitespace (tabs, spaces, and newlines) from the **right** side of a string. It does not affect spaces between words.Input
```liquid diff --git a/_filters/truncate.md b/_filters/truncate.md index c0b0a4e3..7b192dc7 100644 --- a/_filters/truncate.md +++ b/_filters/truncate.md @@ -37,7 +37,7 @@ The length of the second argument counts against the number of characters specif ### No ellipsis -You can truncate to the exact number of characters specified by the first argument and avoid showing trailing characters by passing a blank string as the second argument: +You can truncate to the exact number of characters specified by the first argument and avoid showing trailing characters by passing a blank string as the second argument.Input
```liquid diff --git a/_filters/truncatewords.md b/_filters/truncatewords.md index 6d5c5ab1..15d73133 100644 --- a/_filters/truncatewords.md +++ b/_filters/truncatewords.md @@ -35,7 +35,7 @@ Shortens a string down to the number of words passed as an argument. If the spec ### No ellipsis -You can avoid showing trailing characters by passing a blank string as the second argument: +You can avoid showing trailing characters by passing a blank string as the second argument.Input
```liquid diff --git a/_filters/uniq.md b/_filters/uniq.md index e02b4e9d..c512da7d 100644 --- a/_filters/uniq.md +++ b/_filters/uniq.md @@ -3,7 +3,7 @@ title: uniq description: Liquid filter that removes duplicate items from an array. --- -Removes any duplicate elements in an array. +Removes any duplicate items in an array.Input
```liquid diff --git a/_filters/url_decode.md b/_filters/url_decode.md index e2a7f05f..5ec572fe 100644 --- a/_filters/url_decode.md +++ b/_filters/url_decode.md @@ -4,7 +4,7 @@ description: Liquid filter that decodes percent-encoded characters in a string. version-badge: 4.0.0 --- -Decodes a string that has been encoded as a URL or by [url_encode]({{ "/filters/url_encode/" | prepend: site.baseurl }}). +Decodes a string that has been encoded as a URL or by [`url_encode`]({{ "/filters/url_encode/" | prepend: site.baseurl }}).Input
```liquid diff --git a/_filters/url_encode.md b/_filters/url_encode.md index 5a17c813..b07af5b0 100644 --- a/_filters/url_encode.md +++ b/_filters/url_encode.md @@ -17,6 +17,8 @@ Converts any URL-unsafe characters in a string into percent-encoded characters. {{ "john@liquid.com" | url_encode }} ``` +Note that `url_encode` will turn a space into a `+` sign instead of a percent-encoded character. +Input
```liquid {% raw %} diff --git a/_tags/comment.md b/_tags/comment.md index 4961c00e..39f2c822 100644 --- a/_tags/comment.md +++ b/_tags/comment.md @@ -1,6 +1,6 @@ --- title: Comment -description: An overview of comments tags in the Liquid template language. +description: An overview of comment tags in the Liquid template language. --- Allows you to leave un-rendered code inside a Liquid template. Any text within the opening and closing `comment` blocks will not be printed, and any Liquid code within will not be executed. diff --git a/_tags/control-flow.md b/_tags/control-flow.md index 3a99343e..6a6bfc3e 100644 --- a/_tags/control-flow.md +++ b/_tags/control-flow.md @@ -4,7 +4,7 @@ description: An overview of control flow and conditional tags in the Liquid temp redirect_from: /tags/ --- -Control flow tags can change the information Liquid shows using programming logic. +Control flow tags create conditions that decide whether blocks of Liquid code get executed. ## if @@ -77,7 +77,9 @@ Hey Anonymous! ## case/when -Creates a switch statement to compare a variable with different values. `case` initializes the switch statement, and `when` compares its values. +Creates a switch statement to execute a particular block of code when a variable has a specified value. `case` initializes the switch statement, and `when` statements define the various conditions. + +An optional `else` statement at the end of the case provides code to execute if none of the conditions are met.Input
```liquid diff --git a/_tags/iteration.md b/_tags/iteration.md index 27dcdf6c..ea069598 100644 --- a/_tags/iteration.md +++ b/_tags/iteration.md @@ -3,7 +3,7 @@ title: Iteration description: An overview of iteration or "loop" tags in the Liquid template language. --- -Iteration tags run blocks of code repeatedly. +Iteration tags repeatedly run blocks of code. ## for @@ -331,7 +331,7 @@ Defines how many columns the tables should have. #### limit -Exits the tablerow after a specific index. +Exits the `tablerow` loop after a specific index. ```liquid {% raw %} @@ -343,7 +343,7 @@ Exits the tablerow after a specific index. ### offset -Starts the tablerow after a specific index. +Starts the `tablerow` loop after a specific index. ```liquid {% raw %} diff --git a/_tags/raw.md b/_tags/raw.md index 668cd4d5..7a0e62d2 100644 --- a/_tags/raw.md +++ b/_tags/raw.md @@ -3,7 +3,7 @@ title: Raw description: An overview of raw tags in the Liquid template language. --- -Temporarily disables tag processing. This is useful for generating certain content (eg, Mustache, Handlebars) that uses conflicting syntax. +Temporarily disables tag processing. This is useful for generating certain content that uses conflicting syntax, such as [Mustache](https://mustache.github.io/) or [Handlebars](https://handlebarsjs.com/).Input
```liquid diff --git a/_tags/variable.md b/_tags/variable.md index 76124bb5..3c8f4ca3 100644 --- a/_tags/variable.md +++ b/_tags/variable.md @@ -7,7 +7,7 @@ Variable tags create new Liquid variables. ## assign -Creates a new variable. +Creates a new named variable.Input
```liquid @@ -24,7 +24,7 @@ Creates a new variable. This statement is valid. ``` -Wrap a variable value in quotations `"` to save it as a string. +Wrap a value in quotations `"` to save it as a string variable.Input
```liquid @@ -42,7 +42,7 @@ Wrap a variable value in quotations `"` to save it as a string. ## capture -Captures the string inside of the opening and closing tags and assigns it to a variable. Variables created through `capture` are strings. +Captures the string inside of the opening and closing tags and assigns it to a variable. Variables created using `capture` are stored as strings.Input
```liquid @@ -57,7 +57,7 @@ Captures the string inside of the opening and closing tags and assigns it to a v I am being captured. ``` -Using `capture`, you can create complex strings using other variables created with `assign`: +Using `capture`, you can create complex strings using other variables created with `assign`.Input
```liquid @@ -98,9 +98,9 @@ Creates and outputs a new number variable with initial value `0`. On subsequent {% increment my_counter %} ``` -Variables created through the `increment` tag are independent from variables created through `assign` or `capture`. +Variables created using `increment` are independent from variables created using `assign` or `capture`. -In the example below, a variable named "var" is created through `assign`. The `increment` tag is then used several times on a variable with the same name. Note that the `increment` tag does not affect the value of "var" that was created through `assign`. +In the example below, a variable named "var" is created using `assign`. The `increment` tag is then used several times on a variable with the same name. Note that the `increment` tag does not affect the value of "var" that was created using `assign`.Input
```liquid @@ -142,4 +142,4 @@ Creates and outputs a new number variable with initial value `-1`. On subsequent {% decrement variable %} ``` -Like [increment](#increment), variables declared inside `decrement` are independent from variables created through `assign` or `capture`. +Like [increment](#increment), variables declared using `decrement` are independent from variables created using `assign` or `capture`.