Legacy Knowledge Base
Published Jul. 2, 2025

[CKEditor] Adding alt-text to images

Written By

Rita Schaff

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

Issue

  • In order to comply with WCAG accessibility guidelines, we would like to add alt-text to the images that are uploaded in the Documents & Media gallery. How can we do that?

Environment

  • DXP 7.0+

Resolution

If you try to create a new structure with the Image element, the element's Image Description field provides the alt-text.
structure_imageelement.png

  1. Go to Site→Content & Data→Web Content→Structures tab→add (+ sign)

  2. Under Fields, drag an Image element onto the gray area - it will have to fields, Image and Image description

  3. Save the structure

  4. Create a new web content article with it

  5. Click on the Select button and upload an image

  6. Write the description of the image into the Image Description field, I entered altTextTest

  7. Enter a title for the web content→Publish

  8. Click on Go to site→drag the new web content onto the page

  9. Right-click on the image→Inspect (using Chrome)

  10. Assert that you can see alt="altTextTest"

HTML_altTextTest.png

Note: the steps may be different if you are using CKEditor.

If you have a large database with numerous images, you may want to automate this process. There is an older third-party article that could be helpful, please see Adding an alt-text to an image in Liferay 6.1. Please note this is a best-effort customization not maintained by Liferay, additional assistance is provided by our Global Services team.

 

Additional Information

 

Did this article resolve your issue ?

Legacy Knowledge Base