Deploy Widget via CMS NuGet Package
Use the Content Recommendations block type in Optimizely CMS to add widgets through the content editor interface.
Deploy Widget via CMS NuGet Package
If you have installed the EPiServer.Personalization.Content.UI NuGet package for tracking, a Content Recommendations block type will be available in your Optimizely CMS. Editors can add this block to any page where they want recommendations to appear.
Block Properties
- Number of recommendations: Defines the maximum number of recommended content items to display.
- Delivery Widget: A dropdown list to select the specific Delivery configuration you want to use for this block.
- Recommendation Template: A field to input the Mustache template that defines the HTML structure for each recommended item.
Basic Template Example
You can retrieve a default Mustache template from the Delivery page in the dashboard and customize it.
<div class="recommendations">
<h3>Recommended for you</h3>
<ul>
{{#content}}
<li>
<a href="{{link_url}}">
<img src="{{main_image_url}}?w=150&h=150" alt="{{title}}">
<h4>{{title}}</h4>
</a>
</li>
{{/content}}
</ul>
</div>Note: The recommendation template is rendered on the front-end and cannot access back-end Optimizely CMS APIs or content objects. It only has access to the JSON data returned from the recommendation server.
Limitations
When deploying a widget via the CMS NuGet package, you cannot use script attributes like data-filter to dynamically filter recommendations on the client-side. For more advanced implementations, a manual deployment or direct API integration is recommended.
Updated 4 days ago