-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Included more details about adding defaults to static files #5971
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
Conversation
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.
@jekyll/documentation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!!!
docs/_docs/static_files.md
Outdated
|
||
## 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually
docs/_docs/static_files.md
Outdated
{% if myfile.image == true %} | ||
{{ myfile.path }} | ||
{% endif %} | ||
{% endfor %}{% endraw %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 %}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great, let's use the where filter. i'll make the update.
- removed "actually" - switched code example to use `where`
Thanks for this useful addition @tomjohnson1492 @jekyllbot: merge +docs |
Based on the functionality released in 3.4.2 re adding defaults to static files, I thought this page needed some more detail.