Voog.com

content

Used to define areas that are editable on page:
{% 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.

Attributes

name

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

Bind the content tag to a given article, element, page, product or language object. The string values "Article" (in article template only) and "Element" (in element layout only) are also supported. The content tag renders the named content area of the bound object. If 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 %}

content

Instead of binding an object and its content area by name, pass in a content area directly. In this case, 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 %}

xpage

Set to "true" if you want this content area to be shared across all pages in current language.

readonly

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 %}

single

Defines the content area to be a "singleton" that is created already on the first page load and cannot be removed. Possible values:

  • "plaintext" — removes any rich text functionality from the content area (no formatting, no HTML tags, no line breaks) and renders the contents as a plain string. HTML tags are escaped by default (see escape attribute).
  • "text" — default behaviour

placeholder (only for plaintext content)

This value is rendered when there is no actual content inside the plaintext area.

escape

A boolean value that controls how the content is escaped. "false" makes the contents to be rendered directly as HTML.

invisible

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" %}

title

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" %}

title_tooltip

Sets title tooltip value that is rendered on over the add content area button.

{% content title_tooltip="Add shared content here" %}