ContentBlockByName
→ stringRenders a Content Builder asset by its folder path and name, returning the rendered HTML.
Available in:
Email
CloudPage
Automation
Triggered Send
Syntax
Platform.Function.ContentBlockByName(name[, regionName, stopOnError, fallbackContent, statusVariable])
1–5 arguments
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
name |
string | Yes | The folder path and name of the Content Builder asset (e.g., "My Folder/My Block"). |
regionName |
string | No | The impression region name to associate with this content block. |
stopOnError |
boolean | No | When true, stops rendering if the block is not found. Defaults to false. |
fallbackContent |
string | No | HTML string to render if the block is not found. |
statusVariable |
string | No | Variable name that receives the lookup status. |
Description
Renders a Content Builder block by its name (and optionally its folder path) and returns the rendered HTML.
Use Platform.Function.ContentBlockByKey() when possible — it is more reliable since names can change but external keys persist.
Example
// Block in the root of Content Builder
var html = Platform.Function.ContentBlockByName("Global Header");
// Block in a subfolder
var footer = Platform.Function.ContentBlockByName("Shared/Footer/Standard Footer");
Write(html);
Write(footer);