Octopress Content For
Add content_for and yield tags to Jekyll with conditional rendering and in-line filters.
Installation
Add this line to your application's Gemfile:
gem 'octopress-content-for'
And then execute:
$ bundle
Or install it yourself as:
$ gem install octopress-content-for
Next add it to your gems list in Jekyll's _config.yml
gems:
- octopress-content-for
Usage
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 %}
Contributing
- Fork it ( https://github.com/octopress/content-for/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request