Create Editable Content Areas with MailChimp's Template Language

When coding custom templates with MailChimp's template language, use our recommended naming conventions to identify which areas of your template you would like to be editable from the Design step of the Campaign Builder. We recommend limiting the number of editable spaces to keep your code clean. It is important to create a unique name for each attribute value and to be consistent so you don't lose your content if you switch templates while building your campaigns.

Editable Content Areas

The general attribute format for creating editable content areas is:  mc:edit="section"

Create a unique attribute values and add to elements whose content should be editable. Below are the code names for some common content areas that you can include in your template code:

  • mc:edit="header" 
    Used to name the header of your email.
  • mc:edit="header_image"
    Used to name an editable header image.
  • mc:edit="sidecolumn"
    Used to name an editable left- or right-side column.
  • mc:edit="body"
    Used to name the main content space of your email.
  • mc:edit="footer"
    Used to name the footer of your email.

In the example below, an editable body section is created using the mc:edit="body" attribute.

Editable Image Area

To create editable image areas, add the attribute within an image element. Avoid creating editable images within editable content areas to keep your code clean.

In the example below, the attribute is added to an image element.

Editable Text Header

Add the mc:allowtext attribute to the image element for your header image to allow text to be entered instead of an image.

In the example below, the attribute is added to an image element that is made editable with the mc:edit="section" attribute.

Repeating Content Area

Add the mc:repeatable attribute to any area that includes an mc:edit attribute to create a content block that can be repeatedly added to a template. Repeatable content areas are hidden by default so they only appear in a template if you add them within the Campaign Builder.

In the example below, the mc:repeatable attribute is added to a content area that is made editable with the the mc:edit attribute.

Hideable Content Area

Add the mc:hideable attribute to a content area to allow that block to be toggled between hidden and visible when you build your campaigns. The mc:hideable attribute cannot be used in conjunction with the mc:repeatable attribute.

In the example below, the mc:hideable attribute is added to a content area that is made editable with the mc:edit attribute.

Variable Content Area

Add the mc:variant=”somename” attribute to a content area to allow you to switch between a number of layouts for that content block within the Campaign Builder. The mc:variant attribute requires an attribute name and must be used in conjunction with mc:repeatable.


In the example below, the mc:variant attribute is added to a content area that also uses the mc:repeatable attribute. In this case, the attribute name is “content with left image.”

Was this article helpful?
What can we do to improve your experience with articles like this?

Tagged

Technical Support