{% content name="sidebar" %}
If you want the same content area to be shared across all pages (we like to call it cross-page content), just use extra xpage attribute:
{% content name="footer" xpage="true" %}
Notice that cross-page content remains the same accross the pages in same language environment. So users will have to create content for each language environment.
For last example, there is also an shortcut tag xcontent to generate cross-page content.
See also contentblock tag.
Sets the name to idenfify editable content area because there may be multiple areas on the same page. It is wise not to provide same content name twice on the same page.
If you do not provide name it will default to "body" which is a default content area on each page.
bind
is not provided, the content tag is bound to the current page (or language, in case
of xpage
).This code works everywhere:
{% content name="blogarticle_gallery" bind=blog_item %}
This code works on article page (layout) only:
{% content name="blogarticle_gallery" bind="Article" %}
This way you can add additional content elements, such as forms or photo galleries to your blog article.
On element page similar logic can be used for binding content to element
{% content name="element_content" bind=element_object %}
{% content name="element_content" bind="Element" %}
You should also use new_record? when using this approach.
More examples:
{% for item in articles %}
<h2 class="post-title"><a href="{{ iten.url }}">{{ iten.title }}</a></h2>
<div class="post-excerpt content-formatted">{{ iten.excerpt }}</div>
<div class="gallery">{% content name="blogarticle_gallery" bind=item %}</div>
{% endfor %}
{% for lang in site.languages %}
{% if lang.code == "en" %}
{% content name="banner" bind=lang %}
{% endif %}
{% endfor %}
bind
and name
are ignored. For
example, to render a buy button:
{% load buy_button to "bb" q.buy_button.id="6" %}
{% content content=bb.content %}
Set to "true" if you want this content area to be shared across all pages in current language.
Set to "true" to render the content of the content area as read only (like in public view). It allows to
render same content area more than one time in same layout without messing up content updates. It's also useful for
contents that are updated using API and should be not touched by site editor.
<div class="banner-area">
{% content name="banner-area" readonly=editmode %}
</div>
{% if editmode %}
<div class="banner-area-edit-mode">{% content name="banner-area" %}<div>
{% endif %}
A boolean value that controls how the content is escaped. "false" makes the contents to be rendered directly as HTML.
Set to “true” if you want the content area to appear only if you drag a content area. Otherwise the content area
stays hidden.
{% content invisible="true" %}
Sets title of the add content area button. Will be rendered on the add content area button. Can be used to indicate what kind of content should user use in this content area.
{% content title="Shared content" %}
Sets title tooltip value that is rendered on over the add content area button.
{% content title_tooltip="Add shared content here" %}