New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Included more details about adding defaults to static files #5971

Merged
merged 2 commits into from Mar 21, 2017

Conversation

Projects
None yet
4 participants
@tomjoht
Contributor

tomjoht commented Mar 21, 2017

Based on the functionality released in 3.4.2 re adding defaults to static files, I thought this page needed some more detail.

Included more details about adding defaults to static files
Based on the functionality released in [3.4.2](http://jekyllrb.com/news/2017/03/09/jekyll-3-4-2-released/) re adding defaults to static files, I thought this page needed some more detail.
@tomjoht

This comment has been minimized.

Show comment
Hide comment

@jekyllbot jekyllbot self-assigned this Mar 21, 2017

@DirtyF DirtyF self-assigned this Mar 21, 2017

@parkr

parkr approved these changes Mar 21, 2017

Thank you!!!

Show outdated Hide outdated docs/_docs/static_files.md
## 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.

This comment has been minimized.

@parkr

parkr Mar 21, 2017

Member

actually

@parkr

parkr Mar 21, 2017

Member

actually

Show outdated Hide outdated docs/_docs/static_files.md
{% if myfile.image == true %}
{{ myfile.path }}
{% endif %}
{% endfor %}{% endraw %}

This comment has been minimized.

@parkr

parkr Mar 21, 2017

Member

What do you think about using the where filter here instead of the if in the for loop? It's usually much more performant

{% assign image_files = site.static_files | where: "image", true %}
{% for myimage in image_files %}
  {{ myimage.path }}
{% endfor %}
@parkr

parkr Mar 21, 2017

Member

What do you think about using the where filter here instead of the if in the for loop? It's usually much more performant

{% assign image_files = site.static_files | where: "image", true %}
{% for myimage in image_files %}
  {{ myimage.path }}
{% endfor %}

This comment has been minimized.

@tomjoht

tomjoht Mar 21, 2017

Contributor

great, let's use the where filter. i'll make the update.

@tomjoht

tomjoht Mar 21, 2017

Contributor

great, let's use the where filter. i'll make the update.

updates from parkr's review
- removed "actually"
- switched code example to use `where`
@DirtyF

DirtyF approved these changes Mar 21, 2017

@DirtyF

This comment has been minimized.

Show comment
Hide comment
@DirtyF

DirtyF Mar 21, 2017

Member

Thanks for this useful addition @tomjohnson1492

@jekyllbot: merge +docs

Member

DirtyF commented Mar 21, 2017

Thanks for this useful addition @tomjohnson1492

@jekyllbot: merge +docs

@jekyllbot jekyllbot merged commit 2c4eebc into jekyll:master Mar 21, 2017

0 of 2 checks passed

continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build failed
Details

jekyllbot added a commit that referenced this pull request Mar 21, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment