Content Blocks
  • 17 Jul 2024
  • 6 minute read
  • Dark
    Light
  • PDF

Content Blocks

  • Dark
    Light
  • PDF

Article summary

Content blocks insert large blocks of conditional HTML content into many areas in Slate.

Use cases

Content blocks are handy for information that is frequently reused, like staff email signatures.

They can also be useful for displaying conditional HTML content to specific audiences.

A content block for academic interest resolves to a message about the biology department.

Some examples include:

  • Showing off improvements to your STEM facilities to only those prospects, current students, or alumni who have expressed an interest in STEM.

  • Serving information specific to a mailing recipient’s stated academic interest.

Mailing snippets?

Content blocks have replaced what were formerly known as mailing snippets.

  • You may see content blocks referred to as mailing snippets in Slate documentation and in the Community. The terms are equivalent.

  • Inbox Snippets are distinct from content blocks.

Creating Content Blocks

If you’re just getting started with content blocks, follow these steps to Create Content Blocks before proceeding to Displaying Content Blocks.

🔑 Required permission: Deliver Content Blocks

Configure the Content Block Key

To create a new content block or set of content blocks, you must configure a new content block key.

Keys are groupings of content block codes, or snippets of content that belong together. For example, a series of blurbs about academic programs might be created under a single content block key called “interests”.

To create a new content block key:

  1. Click Deliver in the top navigation bar and select Content Blocks on the right.

  2. Click New Key. Keys group together content block codes, or snippets of HTML content, with a similar purpose.

  3. Enter the following configurations in the popup window:

    • Key - Give this set of Content Blocks a computer-friendly name, such as "interest." It should not include any spaces or special characters.

    • Folder (optional) - Place the Content Block in an existing folder, or create a new one by selecting Other and entering a name (in this case, "Academic Interests").

    • Type - Select the type of value that these content blocks should match in the mailing.

      • Select String (Discrete Values) if the value of the content block should exactly match a string. Note that strings are case-sensitive (ex. “Biology” is not the same as “biology”)

      • Select Integer (Inclusive Range of Values) if the value of the content block should fall within a specified range of integers.

      • Select Real Number (Inclusive Range of Values) if the value of the content block should fall within a specified range of real numbers.

      • Select Date (Inclusive Range of Values) if the value of the content block should fall within a range of dates.

      • Select DateTime (Inclusive Range of Values) if the value of the content blocks should fall within a specified range of dates and times.

    • Default Snippet (optional) - Include a default snippet [block] to have this content displayed in cases where the data does not match any of the content block values. If no default snippet is specified, no content will be displayed.

  4. Click Save. Once a key has been created, click the Edit button at any time to edit these settings.

For example, a use case is that Slate University would like to merge in something relevant to the recipient's interest in an academic major. The configuration of a set of content blocks for interest might look like the following:

Example_Content_Blocks.png

Configure the Content Block Content

Multiple codes can be configured per content block key. Codes are the technical name for each individual snippet, or chunk, of HTML content that you want to deliver. Colloquially, codes might be referred to as “blocks,” “snippets,” “content blocks,” or “content.” When configuring each code, it is important to remember that the value of each content block code should correspond with the type that was selected on the previous screen (ex. string, real, or integer). To create the content block code:

  1. Click New Code.

  2. Enter the following configurations in the popup window:

    • Status - Leave this as Active.

    • Value - For String content blocks, enter a string for the value (e.g., Biology). These values should exactly match the export from the query that will reference the content blocks. For Integer, Real Number, Date, and DateTime content blocks, enter a minimum and maximum value.

    • Snippet - Use the WYSIWYG editor to create the content for the this content block value.

  3. Click Save.

  4. Repeat steps 1-3 to create additional content blocks that use this key.

Continuing with the Slate University use case, one content block code using the key of interest might look like:

Biology_Content_Block_Example.png

Tip

For content blocks where the numeric values are discrete rather than a range, the Minimum Value and the Maximum Value can be the same.

Content Block Values with Special Characters

Content block values should not contain special characters such as ampersands (&), apostrophes ('), quotation marks (") or slashes (/).

If content blocks need to match on values that contain special values, use a Custom SQL format mask to replace these characters with their string equivalent. This format mask should be added to whatever export is being referenced in the Content Block merge field.

For example, if you apply a Content Block to their Major field, the Custom SQL format mask should be added to the "Major" export on the associated query.

To replace an ampersand with the word "and":

replace(@val, '&','and')

To remove an apostrophe:

replace(@val, '''','')

Displaying Content Blocks

Content blocks are displayed by referencing an export or merge field within areas of Slate that support them. Remember that your content block will leverage the output, or value, of an export/merge field. Be sure to include an export that returns data matching the value you specified when configuring your content block codes.

🔔 The CC field, recipient line, and subject line of a mailing should never be populated with a content block. Use a translation code or liquid markup instead.

To insert a content block as a merge field:

  1. In the WYSIWYG editor, place the cursor where the content block content should appear.

  2. Click Merge Field Merge_Field_Button.png in the top row of the WYSIWYG editor.

  3. From the list, select Other.

  4. Enter the following text:

    NAME OF EXPORT | block: "KEY OF CONTENT BLOCK"

    where NAME OF EXPORT is the name of the export in the recipient list query, and KEY OF CONTENT BLOCK is the key of the content block that contains the codes to merge into your text.

  5. Click OK.

Using the “interest” content block key example with an export labeled “academic_interests”, the merge field will appear as shown:

When viewing the message in the WYSIWYG editor, it will appear simplistic with only the merge fields displayed:

When the content is shown to the intended recipient, however, it will display the content from the specified content block key and code. In Deliver, we can use the Preview Message option to preview this from a prospective recipient’s perspective. For instance, this sample record has an academic major interest of Biology, so the content block code with the value of "Biology" displays:

A sample record with the academic major interest of Physics will display the content block code with the value “Physics”:

Tip

Including a default content block with the content block key ensures that every recipient has content merged in from the content block. If no default content block is included, records without data matching one of the content block values will have a blank line where the content block would otherwise appear.

Dynamic content blocks

Content blocks can incorporate liquid markup and translation codes, meaning these tools can all be used together.

📖 Further reading: Dynamic Content Blocks


Was this article helpful?