From 8c6f4c2f925ecbe2b1edcaa65141cba0bc810934 Mon Sep 17 00:00:00 2001 From: Adam Hollett Date: Fri, 18 Mar 2016 22:42:16 -0400 Subject: [PATCH] Fix all the links --- basics/introduction.md | 6 ++--- basics/truthy-and-falsy.md | 18 ++------------- basics/types.md | 47 ++++---------------------------------- filters/divided_by.md | 2 +- 4 files changed, 10 insertions(+), 63 deletions(-) diff --git a/basics/introduction.md b/basics/introduction.md index 23b84c5..2dd1e81 100644 --- a/basics/introduction.md +++ b/basics/introduction.md @@ -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. diff --git a/basics/truthy-and-falsy.md b/basics/truthy-and-falsy.md index c760a6a..63a5ca8 100644 --- a/basics/truthy-and-falsy.md +++ b/basics/truthy-and-falsy.md @@ -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

``` -[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] %} -
{{ pages[settings.page].content }}
-{% endif %} -{% endraw %} -``` - -```html -
-``` - ## 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 diff --git a/basics/types.md b/basics/types.md index f4f5825..37b6f24 100644 --- a/basics/types.md +++ b/basics/types.md @@ -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? %} - -

{{ pages.frontpage.title }}

-
{{ pages.frontpage.content }}
-{% endunless %} -{% endraw %} -``` - -If you don't check for emptiness first, Liquid might print empty HTML elements to the page: - -```html -

-
-``` +You can, however, use the [split]({{ "/filters/split" | prepend: site.baseurl }}) filter to break a string into an array of substrings. diff --git a/filters/divided_by.md b/filters/divided_by.md index a455fd1..b17e4bd 100644 --- a/filters/divided_by.md +++ b/filters/divided_by.md @@ -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 %}