Introduction to Snippets

Snippets are blocks of code that can be utilized in code templates in your organization. Use snippets to standardize components of an email, such as your organization's logo header or address footer and you can make maintaining consistency and updating common template elements easier across all code templates in your organization.

This article is for the legacy code editor only. The visual editor uses blocks, to read about creating blocks for the visual editor see Building Blocks with DML.

Snippets Page

View a list of your available snippets on the Snippets Page. This is where your team will create and manage snippets. In addition to its name, for each snippet we’ll display:

  • The name of the user who made the last update, and when
  • The number of code templates currently referencing that snippet
Snippet Page

Create a Snippet

Click the Create Snippet button and select the type of snippet you would like to create. Give the snippet a useful name as you will use this name to reference the snippet in your code templates.

Add a description to help your team members quickly identify the snippet's purpose. Add your content in the snippet editor and click Save when finished.

Snippet editor

Edit a Snippet

From the Snippets Page select a snippet to edit. Once you've made your changes click Save and the edited snippet content will update automatically across any code template drafts referencing the snippet.

Published code templates referencing a snippet will not update automatically when snippet edits are saved.

To update a published template with the modified snippet, the template must go through the approval process. Create a new draft for each published template that references the edited snippet, preview a template with the updated snippet content, and submit the draft for approval. Once approved, the published template will now be available via the API with the updated snippet content.

Reference a Snippet

To use a snippet in a code template, reference the snippet name with the following syntax:

{% snippet "snippetname" %}

If the snippet is in a folder reference the path to the snippet with the following syntax:

Team Snippet

{% snippet "foldername/snippetname" %}
Using a snippet
Snippets are case sensitive. If your snippet was created using a capital letter, the reference must match that

Didn't find what you're looking for?

Ask our support team, we're here to help!

Contact Support