content_for
Content renderer for objects inside the Plate Nested Layout Structure: Post
, Section
, Row
, Column
and Content Element
. This not only renders the content, but also makes sure the content is editable for the user in the site’s edit mode, and adds HTML attributes for positioning so the content shows in the right place.
Input:
{% content_for post %}
{% render_content %}
{% endcontent_for %}
Output:
<div data-id="post_6734" class="plate--page-content-wrapper">
<!-- Content for post -->
</div>
You can add custom HTML attributes to extend the HTML container with. If you add disable_handles: true
, the content won’t show editing handles in edit mode, so the user is kept from editing the content.
Input:
{% content_for post, class: "test-class", data_test_data: "data-test-value", disable_handles: true %}
{% render_content %}
{% endcontent_for %}
Output:
You can also add custom HTML attributes to the render_content
tag inside the content_for
block. This generates a div within the outer container, containing the content. This especially comes in handy for sections (which usually are full page width), that have a container div inside (that conforms to the Plate responsive grid system).
Input:
Output: