AMP-Mustache Troubleshooting

read

If you've received an AMP-Mustache warning, your AMP code contains AMP-Mustache syntax. This is how AMP fills in content based on a dynamic endpoint each time the URL is opened. Unfortunately, AMP-Mustache uses curly brace syntax to represent variables, which conflicts with the curly braces for Django variables (e.g. {{ person.first_name }} ).

To ensure that the AMP email behaves as expected when in the inbox, Klaviyo needs to know not to render those AMP-Mustache curly brace variables as if they are Django variables. The way to do this is by using the verbatim Django tag.

For example, if you have the following section of AMP-Mustache syntax, you need to wrap it in verbatim tags -- {% verbatim %} Your AMP Mustache Code {% end verbatim %}. For example, an abandoned cart email might look like below.

<body>
Check out these latest deals from our store!
<amp-list src="https://amp.dev/static/samples/json/cart.json" layout="fixed-height" height="80">
{% verbatim %}
<template type="amp-mustache">
<div id="cart">
<!-- These items can be updated dynamically. -->
{{#cart_items}}
<div class="cart-item">
<span>{{name}}</span>
</div>
{{/cart_items}}
{{^cart_items}}
There are no featured products available. Please check back again later.
{{/cart_items}}
</div>
</template>
{% end verbatim %}
</amp-list>
</body>

If you are trying to mix Klaviyo variables and AMP-Mustache variables, you'll need to add verbatim tags around the specific tags you want to be interpreted as AMP-Mustache instead of around the entire AMP-Mustache section. For example,

<body>
Check out these latest deals from our store!
<amp-list src="https://amp.dev/static/samples/json/cart.json" layout="fixed-height" height="80">
<template type="amp-mustache">
<div id="cart">
<!-- These items can be updated dynamically. -->
{% verbatim %}{{#cart_items}}{% end verbatim %}
Hey {{ person.first_name }}, we saved these just for you!
<div class="cart-item">
<span>{% verbatim %}{{name}}{% end verbatim %}</span>
</div>
{% verbatim %}{{/cart_items}}{% end verbatim %}
{% verbatim %}{{^cart_items}}{% end verbatim %}
There are no featured products available. Please check back again later.
{% verbatim %}{{/cart_items}}{% end verbatim %}
</div>
</template>
</amp-list>
</body>

For additional questions, head to our article on Sending AMP Emails in Klaviyo

x
Was this article helpful?
0 out of 0 found this helpful