diff --git a/.gitignore b/.gitignore index 580c589..3a2ab3d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ _site/ .sass-cache/ node_modules/ +Gemfile.lock # Compiled source # ################### @@ -38,4 +39,4 @@ node_modules/ .Spotlight-V100 .Trashes ehthumbs.db -Thumbs.db \ No newline at end of file +Thumbs.db diff --git a/_config.yml b/_config.yml index 06ac8d6..993b70e 100644 --- a/_config.yml +++ b/_config.yml @@ -4,7 +4,7 @@ repository: https://github.com/Shopify/liquid # Build settings baseurl: /liquid # the subpath of your site, e.g. /blog/ -url: http://liquidmarkup.org # the base hostname & protocol for your site +url: https://shopify.github.io # the base hostname & protocol for your site markdown: redcarpet redcarpet: extensions: ["with_toc_data", "tables", "disable_indented_code_blocks", "no_intra_emphasis"] diff --git a/_includes/home-users-grid.html b/_includes/home-users-grid.html index 5beefba..5f9b40d 100644 --- a/_includes/home-users-grid.html +++ b/_includes/home-users-grid.html @@ -1,22 +1,22 @@
- - + + Jekyll logo
- - + + Desk logo
- - + + ZenDesk logo
- - + + 500px logo
diff --git a/_layouts/default.html b/_layouts/default.html index a986465..d7bbd0a 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -9,11 +9,11 @@ - + - + diff --git a/basics/_handles.md b/basics/_handles.md deleted file mode 100644 index fca2b14..0000000 --- a/basics/_handles.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -title: Handles ---- - -A handle is used to access the attributes of a Liquid object. By default, the handle 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 `about-us` as shown below: - -{% highlight liquid %} -{% raw %} - -{{ pages.about-us.content }} -{% endraw %} -{% endhighlight %} - -## Creating handles - -An object with the title "Shirt" will automatically be given the handle `shirt`. If there is already an object with the handle `shirt`, the handle will auto-increment. In other words, "Shirt" objects created after the first one will receive the handle `shirt-1`, `shirt-2`, and so on. - -Whitespace in titles is replaced by hyphens in handles. For example, the title "My Shiny New Title" will be given the handle `my-shiny-new-title`. - -Handles also determine the URL of their corresponding objects. For example, a page with the handle `about-us` would have the url `/pages/about-us`. - -Websites often rely on static handles for pages, posts, or objects. To preserve design elements and avoid broken links, if you modify the title of an object, **its handle is not automatically updated**. For example, if you were to change a page title from "About Us" to "About This Website", its handle would still be `about-us`. - -You can change an object's handle manually (TK how to change a handle manually) - -## Accessing handle attributes - -In many cases you may know the handle of a object whose attributes you want to access. You can access its attributes by pluralizing the name of the object, then using either the square bracket ( [ ] ) or dot ( . ) notation. - -
-{% highlight liquid %} -{% raw %} -{{ pages.about-us.title }} -{{ pages["about-us"].title }} -{% endraw %} -{% endhighlight %} -
- -
-{% highlight text %} -About Us -About Us -{% endhighlight %} -
- -In the example above, notice that we are using `pages` as opposed to `page`. 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..703a0ae 100644 --- a/basics/truthy-and-falsy.md +++ b/basics/truthy-and-falsy.md @@ -18,13 +18,13 @@ In the example below, the string "Tobi" is not a boolean, but it is truthy in a {% raw %} {% assign tobi = "Tobi" %} -{% if tobi == true %} +{% if tobi %} This condition will always be true. {% endif %} {% 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 %}