Alt text helper for Optimizely CMS 12 and Optimizely DAM

Mar 18, 2024  

Figure: ALT Attribute - Author: Seobility - License: CC BY-SA 4.0Author: Seobility - License: CC BY-SA 4.0Optimizely CMS 12 offers out the box integration with Optimizely DAM allowing users to easily select images from the DAM. Its also possible to access the meta data for these assets such as the alt text.

One of the most common requests I hear is "How do I access the alt text for the image". Implementors can render alt text to a page using ASP.net MVC or HTML or tag helpers as described here: Caching & Rendering of metadata from the DAM. However many developers just want to grab the alt text to put into their own view models or even use directly in the view.

This post describes a helper I put together to help implementors get the alt text for an image from Optimizely DAM using Optimizely CMS 12. The code for the helper allows users to pass a content reference and will return a string containing the alt text of the image as configured in Optimizely CMP.

Implementation

Steps to implement: