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.
In this article:
- Editable Content Areas
- Editable Image Area
- Editable Text Header
- Repeating Content Area
- Hideable Content Area
- Variable Content Area
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:
Used to name the header of your email.
Used to name an editable header image.
Used to name an editable left- or right-side column.
Used to name the main content space of your email.
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.
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.”
- If you're editing hideable sections in the Campaign Builder using the remove button in your campaign, please note that the section won't disappear in the Campaign Builder screen. The section you want to remove will fade, but it will remain just in case you change your mind and want to use the space. However, when you send out your email, the section you have "removed" won't appear in your campaign. You can preview this change by clicking on Preview and Test and then Enter Preview Mode.
- The remove and hide this section buttons don't offer the same functionality in the Template editor. In fact, you can't actually remove anything while working in the Template editor. If you need to make changes like that, we suggest you work in the Campaign Builder instead.
|Was this article helpful?||
|What can we do to improve your experience with articles like this?|
At this time, we are unable to reply to any responses, but we'll use this information to keep the site up-to-date.