# Copy a layout and change its HTML

> Filter Assets › Layouts by scope, open an existing email layout, make a copy, rename it and change its Handlebars markup in the HTML editor.

The safest way to restyle the product block of your emails is to copy a layout that works and change the copy. The original keeps serving the emails that use it until you switch them over. This guide copies an **Email** layout that uses the **HTML** editor and changes its markup. For the scopes, editors and what a layout may contain, read [How layouts work](https://releva.ai/documentation/learn/layouts/how-layouts-work/).

## Before you start

* A layout with the **Email** scope exists under **Assets › Layouts**. If you have none, follow [Create a layout for email product blocks](https://releva.ai/documentation/guides/layouts/create-a-layout-for-email-product-blocks/) first.
* You know basic HTML. Email layouts are written in HTML with [Handlebars](https://handlebarsjs.com/) expressions; keep styles inline, because email clients often ignore `<style>` blocks.
* Your plan includes creating layouts. If **Make a copy** shows a lock with **Unlock feature.**, ask your account owner.

## Steps

1. In the left menu, select **Assets › Layouts**.

   ![Step 1](https://releva.ai/documentation/_astro/step-1.DVUd-1nP_mMoTs.webp)

2. To narrow the list, open **Scope** and select **Email**. **Usage** filters the list to layouts that are **Used** or **Not used**.

   The search box above the list matches the beginning of words in the layout name.

   ![Step 2](https://releva.ai/documentation/_astro/step-2.BQUGtjO5_29NvyD.webp)

3. Select the name of the layout you want to start from, for example **Demo email product row**.

   The badges on the card tell you the scope (**EMAIL**), the editor (**HTML EDITOR** or **VISUAL EDITOR**) and, for a used layout, the emails that use it.

   ![Step 3](https://releva.ai/documentation/_astro/step-3.GdUEujtn_Z3wnii.webp)

4. The layout opens read-only, so you cannot change it by accident.

   To change the original instead of a copy, select **Edit**. The form then warns you which account and shop you are editing in.

   ![Step 4](https://releva.ai/documentation/_astro/step-4.BU_vCzWg_ZtmS9I.webp)

5. Select **Make a copy**.

   ![Step 5](https://releva.ai/documentation/_astro/step-5.DlitnF7K_Z1PdnLc.webp)

6. The copy opens as a new layout called “Copy of” plus the original name, with the same scope and editor. In **Name**, enter a new name, for example “Demo email product row for sales”.

   Scope and editor are locked on the copy: an HTML email layout stays an HTML email layout.

   ![Step 6](https://releva.ai/documentation/_astro/step-6.CLVAqBzZ_Z1YqYyz.webp)

7. Change the markup in the HTML editor. The preview on the left shows the result with products from your catalog. Inline `style` attributes are the safest way to style an email.

   The layout loops over `products` with `{{#each products}} … {{/each}}` and prints each product’s fields, for example `{{name}}`, `{{imageUrl}}` and `{{addUtm url}}`. Select **Custom Helper Functions** for the list of helpers you can use, such as `formatPrice` and `truncate`. Inside a Handlebars expression that sits in an HTML attribute, use single quotes: `class="{{#if a}}'x'{{/if}}"`.

   ![Step 7](https://releva.ai/documentation/_astro/step-7.CALqioCt_GpmL8.webp)

8. Select **Save & close**.

   ![Step 8](https://releva.ai/documentation/_astro/step-8.BXuR98pD_ZSMHHr.webp)

9. The copy is in the list. Choose it as the template of an email’s product block to use it.

   ![Step 9](https://releva.ai/documentation/_astro/step-9.BxIxpABS_Z1PCh8Q.webp)

## Check it worked

* The copy is the first card under **Assets › Layouts** with the **EMAIL** and **HTML EDITOR** badges and **Not used**.
* Open the copy: the markup is the one you saved and the preview draws your products with it.
* Open the original: it is unchanged and, if it was in use, still lists its emails.
* Pick the copy in the product block of an email (see [Personalisation in How emails work](https://releva.ai/documentation/learn/emails/how-emails-work/#personalisation)) and send yourself a test email.

## Troubleshooting

**Layout Name must be unique!** appears after you save. Another layout of this shop already has that name, in any capitalisation. Change the name.

**The layout markup could not be parsed: Parse Error: …** appears after you save. The HTML could not be read. The message ends with “A common cause is a Handlebars expression using double quotes inside an HTML attribute; use single quotes inside the expression instead.” Fix the markup at the quoted position and save again.

**The preview is blank or shows “Unable to show preview due to template markup errors”.** A Handlebars expression does not compile, for example an unclosed `{{#each}}`. Fix the expression; the preview updates as you type.

**The layout cannot be deleted.** **Delete** is disabled while a product block or an email uses the layout; hover over it to see which. Remove the layout from them first.

**My HTML comments disappeared.** Releva minifies the markup when it saves it and removes comments. Emails render the minified markup, so do not rely on comments.

**The copy has no Edit on my site button.** That button exists only for **Web** and **Search As You Type** layouts, which run on your site. Email layouts are checked in the preview and in a test email.

## Next steps

* [Create a layout for email product blocks](https://releva.ai/documentation/guides/layouts/create-a-layout-for-email-product-blocks/): Build a new email layout in the Visual editor instead of HTML.
* [How layouts work](https://releva.ai/documentation/learn/layouts/how-layouts-work/): Learn what the markup can use and where a layout is chosen.
* [How emails work](https://releva.ai/documentation/learn/emails/how-emails-work/): Learn how product blocks with your layout appear in an email.