Content Snippets can be used when there you have pieces of content that you would like to reuse without having to recreate it time and time again. For example a menu structure in an email. They can also be used if the aim is to control the content from a central point so updating just the snippet content will then update across all campaigns which are referencing that snippet.
Creating a Snippet
Snippets can be found and managed in Content Management > Snippets
Opening this section you will have the choice of creating either a Text or HTML snippet by selecting one of the on screen options.
Text
Using the simple text editor you can set the content you want, including personalisation tags to pull in profile attributes and other details which may link to a specific user.
HTML
Uses the full HTML editor to allow you to create whatever content you require.
Bear in mind how this content will fit into your larger template. If building for email for example you may need to make sure you include any mobile optimised styles to allow the snippet's content to remain flexible when viewed on a mobile screen.
Using a Snippet
Once you have created your snippet you will want to use it in other areas of the platform.
Let's take the example of the HTML snippet and the menu structure we have created.
Opening an email within a campaign we simply add the snippet token syntax in the place we want the snippet content to be rendered at time of send.
Token Syntax
Snippets are referenced using the following twig syntax:
{{ snippet('snippet_name') }}
In our email example that would be {{ snippet('top_navigation') }} and would look like this:
The combined result at send time would then look like this:
This now means we can reuse this top_navigation snippet across multiple emails without the need to recreate it each time.
It also means that if we ever decide to update the navigation we can do so directly in the snippet and have it automatically updated in all emails* which it is referenced in.
*remember snippets are rendered at send time and so any emails which have already been sent and are sitting in a customers inbox will not be affected.
Comments
0 comments
Article is closed for comments.