Inline page editing

Gerbi CMS provide a way to easily edit the placeholder’s content on your own frontend when you are authenticated as a staff user.


To activate the feature on your frontend you need to add 2 tags inside your templates. One in your <head> tag and one in the <body> tag:

{% load pages_tags static i18n %}
        {% pages_edit_media %}
        {% pages_edit_init %}

For placeholder editing to work properly you will need to surround the placeholder with an HTML element like so:

    {% placeholder "title" %}

Placeholder editing works automatically by injecting an HTML comment into the placeholder output. So thing like this will not work:

    <img src="{{ MEDIA_URL }}{% imageplaceholder "img" %}">

Because the rendered comment will not result into an HTML node:

    <img src="upload/image.png<!--placeholder:img-->">

To fix this issue you can use placeholders as rendering blocks like so:

    {% imageplaceholder 'img' block %}
        {% if content %}
            <img src="{{ MEDIA_URL }}{{ content }}" class="img-responsive" alt="">
        {% endif %}
    {% endplaceholder %}