Fix all the links

This commit is contained in:
Adam Hollett
2016-03-18 22:42:16 -04:00
parent 3b0f5c45c2
commit 8c6f4c2f92
4 changed files with 10 additions and 63 deletions

View File

@@ -42,9 +42,9 @@ Hello Adam!
Tags can be categorized into three types:
- [Control flow](/tags/control-flow)
- [Iteration](/tags/iteration)
- [Variable assignments](/tags/variable)
- [Control flow]({{ "/tags/control-flow" | prepend: site.baseurl }})
- [Iteration]({{ "/tags/iteration" | prepend: site.baseurl }})
- [Variable assignments]({{ "/tags/variable" | prepend: site.baseurl }})
You can read more about each type of tag in their respective sections.

View File

@@ -24,7 +24,7 @@ In the example below, the string "Tobi" is not a boolean, but it is truthy in a
{% endraw %}
```
[Strings](/basics/types/#string), even when empty, are truthy. The example below will result in empty HTML tags if `settings.fp_heading` is empty:
[Strings]({{ "/basics/types/#string" | prepend: site.baseurl }}), even when empty, are truthy. The example below will result in empty HTML tags if `settings.fp_heading` is empty:
```liquid
{% raw %}
@@ -38,23 +38,9 @@ In the example below, the string "Tobi" is not a boolean, but it is truthy in a
<h1></h1>
```
[EmptyDrops](/basics/types/#emptydrop) are also truthy. In the example below, if `settings.page` is an empty string or set to a hidden or deleted object, you will end up with an EmptyDrop. The result is an empty `div`:
```liquid
{% raw %}
{% if pages[settings.page] %}
<div>{{ pages[settings.page].content }}</div>
{% endif %}
{% endraw %}
```
```html
<div></div>
```
## Falsy
The falsy values in Liquid are [`nil`](/basics/types/#nil) and [`false`](/basics/types/#boolean).
The falsy values in Liquid are [`nil`]({{ "/basics/types/#nil" | prepend: site.baseurl }}) and [`false`]({{ "/basics/types/#boolean" | prepend: site.baseurl }}).
## Summary

View File

@@ -9,9 +9,8 @@ Liquid objects can have one of six types:
- [Boolean](#boolean)
- [Nil](#nil)
- [Array](#array)
- [EmptyDrop](#emptydrop)
You can initialize Liquid variables with the [assign](/tags/#assign) or [capture](/tags/#capture) tags.
You can initialize Liquid variables with the [assign]({{ "/tags/variable/#assign" | prepend: site.baseurl }}) or [capture]({{ "/tags/variable/#capture" | prepend: site.baseurl }}) tags.
## String
@@ -49,7 +48,7 @@ Booleans are either `true` or `false`. No quotations are necessary when declarin
Nil is a special empty value that is returned when Liquid code has no results. It is **not** a string with the characters "nil".
Nil is [treated as false](/basics/truthy-and-falsy) in the conditions of `if` blocks and other Liquid tags that check the truthfulness of a statement.
Nil is [treated as false]({{ "/basics/truthy-and-falsy" | prepend: site.baseurl }}) in the conditions of `if` blocks and other Liquid tags that check the truthfulness of a statement.
In the following example, if the user does not exist (that is, `user` returns `nil`), Liquid will not print the greeting:
@@ -79,7 +78,7 @@ Arrays hold lists of variables of any type.
### Accessing items in arrays
To access all the items in an array, you can loop through each item in the array using an [iteration tag](/tags/iteration/).
To access all the items in an array, you can loop through each item in the array using an [iteration tag]({{ "/tags/iteration" | prepend: site.baseurl }}).
```liquid
{% raw %}
@@ -119,42 +118,4 @@ Adam
You cannot initialize arrays using only Liquid.
You can, however, use the [split](/filters/split) filter to break a string into an array of substrings.
## EmptyDrop
An EmptyDrop object is returned if you try to access a deleted object by name. In the example below, `page_1`, `page_2` and `page_3` are all EmptyDrop objects.
```liquid
{% raw %}
{% assign variable = "hello" %}
{% assign page_1 = pages[variable] %}
{% assign page_2 = pages["does-not-exist"] %}
{% assign page_3 = pages.this-handle-does-not-exist %}
{% endraw %}
```
EmptyDrop objects only have one attribute, `empty?`, which is always *true*.
Collections and pages that *do* exist do not have an `empty?` attribute. Their `empty?` is "falsy", which means that calling it inside an if statement will return *false*. When using an `unless` statement on existing collections and pages, `empty?` will return `true`.
### Checking for emptiness
Using the `empty?` attribute, you can check to see if an object exists or not before you access any of its attributes.
```liquid
{% raw %}
{% unless pages.about.empty? %}
<!-- This will only print if the page with handle 'about' is not empty -->
<h1>{{ pages.frontpage.title }}</h1>
<div>{{ pages.frontpage.content }}</div>
{% endunless %}
{% endraw %}
```
If you don't check for emptiness first, Liquid might print empty HTML elements to the page:
```html
<h1></h1>
<div></div>
```
You can, however, use the [split]({{ "/filters/split" | prepend: site.baseurl }}) filter to break a string into an array of substrings.

View File

@@ -4,7 +4,7 @@ title: divided_by
Divides a number by the specified number.
The result is rounded down to the nearest integer (that is, the [floor](/filters/floor)).
The result is rounded down to the nearest integer (that is, the [floor]({{ "/filters/floor" | prepend: site.baseurl }})).
```liquid
{% raw %}