Add content_for and yield tags to Jekyll with conditional rendering and in-line filters.
If you're using bundler add this gem to your site's Gemfile in the :jekyll_plugins
group:
group :jekyll_plugins do
gem 'octopress-content-for'
end
Then install the gem with Bundler
$ bundle
To install manually without bundler:
$ gem install octopress-content-for
Then add the gem to your Jekyll configuration.
gems:
-octopress-content-for
Use it like a typical content_for
tag.
{% content_for awesome_content %}
some content
{% endcontent_for %}
{% yield awesome_content %} //=> some content
Use in-line filters.
{% yield awesome_content | upcase %} //=> SOME CONTENT
Use conditional rendering in both content_for
and yield
tags.
{% content_for footer unless page.footer == false %}
Footer!
{% endcontent_for %}
{% yield footer if page.footer %}
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)