From fe6d4c7beaf315b55623b2c686116f055cd62f2a Mon Sep 17 00:00:00 2001 From: Tom Johnson Date: Tue, 21 Mar 2017 10:27:05 -0700 Subject: [PATCH] updates from parkr's review - removed "actually" - switched code example to use `where` --- docs/_docs/static_files.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/_docs/static_files.md b/docs/_docs/static_files.md index fbb03e79..a4dda588 100644 --- a/docs/_docs/static_files.md +++ b/docs/_docs/static_files.md @@ -70,7 +70,7 @@ Note that in the above table, `file` can be anything. It's simply an arbitrarily ## Add front matter to static files -Although you can't directly add front matter values to static files, you can actually set front matter values through the [defaults property](../configuration/#front-matter-defaults) in your configuration file. When Jekyll builds the site, it will use the front matter values you set. +Although you can't directly add front matter values to static files, you can set front matter values through the [defaults property](../configuration/#front-matter-defaults) in your configuration file. When Jekyll builds the site, it will use the front matter values you set. Here's an example: @@ -89,10 +89,9 @@ This assumes that your Jekyll site has a folder path of `assets/img` where you Suppose you want to list all your image assets as contained in `assets/img`. You could use this for loop to look in the `static_files` object and get all static files that have this front matter property: ```liquid -{% raw %}{% for myfile in site.static_files %} - {% if myfile.image == true %} - {{ myfile.path }} - {% endif %} +{% raw %}{% assign image_files = site.static_files | where: "image", true %} +{% for myimage in image_files %} + {{ myimage.path }} {% endfor %}{% endraw %} ```