Module: Roda::RodaPlugins::ContentFor
- Defined in:
- lib/roda/plugins/content_for.rb
Overview
The content_for plugin is designed to be used with the render plugin, allowing you to store content inside one template, and retrieve that content inside a separate template. Most commonly, this is so view templates can set content for the layout template to display outside of the normal content pane.
The content_for template probably only works with erb templates, and requires that you don’t override the :outvar
render option. In the template in which you want to store content, call content_for with a block:
<% content_for :foo do %>
Some content here.
<% end %>
In the template in which you want to retrieve content, call content_for without the block:
<%= content_for :foo %>
Defined Under Namespace
Modules: InstanceMethods
Class Method Summary collapse
-
.load_dependencies(app) ⇒ Object
Depend on the render plugin, since this plugin only makes sense when the render plugin is used.
Class Method Details
.load_dependencies(app) ⇒ Object
Depend on the render plugin, since this plugin only makes sense when the render plugin is used.
26 27 28 |
# File 'lib/roda/plugins/content_for.rb', line 26 def self.load_dependencies(app) app.plugin :render end |