I just started using content builder and noticed it isn't clear how to define an AmpScript block as part of a template. I tried using but that seems to break the template formatting. Are ampscript blocks supported?
AMPScript is definitely supported in Content Builder. AMPScript typically does jack up the code in the editor.
Here's a little trick I use to "pretty up" the AMPScript:
%%[/* Modify to view AMPScript <div style="display:none"> */ /* your big blob of AMPScript goes here */ /* </div> */ ]%%
Update: Placeholders vs Content Areas
Content area placeholders for Paste HTML templates
<custom type="content" name="test"> are different than AMPScript blocks. When you define a template, you can add as many placeholders as you want. You can then edit the content of those placeholder content areas when you create a new templated email.
AMPScript blocks begin and end with
]%%. You can add AMPScript blocks directly in the template HTML or you can add them to the placeholder content area once you create the email based on the template.
Breakdown of each element in the Content Area definition:
- data-type: must always be "slot"
- data-key: unique identifier for the content area. Must be unique within each template.
- data-max-blocks: the maximum number of blocks allowed in that content area. If not defined, it's unlimited.
- data-allowed-blocks: the types of blocks that can be dragged to that content area. If not defined, all types are allowed in that content area.
- data-label: the message that appears inside the content area if it's empty. Default is "Drop blocks or content here" if not defined.
The placeholder for Content Builder is different than for Classic Content, it's basically div element with custom attributes. Looks like this:
<div data-type="slot" data-key="uniqName" data-max-blocks="" data-allowed-blocks="" data-label="Drop content blocks here"></div>
I can't find reference in documentation what each attribute is for.