DXA 2.2 resolves the ECL item added as a hyperlink in Rich Text Field
Prior to DXA 2.2, an editor can only embed an ECL (external Content Item) item in Rich Text fields inside of HTML <img> tags. That means DXA render component content template never resolves any ECL item if that is not inside the image tag.
DXA 2.2 enhances this existing feature to support other types of content and other HTML tags.
For example, now the user can embed links to PDFs or other downloadable ECL files as a hyperlink inside the Rich Text Field.
How to Achieve That:
So the good news is to enable this feature, you have to just update the parameter in the below templates
Render Component Content
Render Page Content
As you may know, In DXA 2.2 a new parameter called schemasToEmbedInRichText has been introduced to those Template Building Blocks. This parameter basically defines the types of Components links (in addition to Multimedia Component links) that will always be expanded.
Here is an example –
The customer wants to embed a pdf link (stored as an ECL item) as a hyperlink in the RTF field.
<a title="abc" href="ecl:xx-mm-6C05!2D;0C7D!2D;4B93!2D;9DXXXXXXXX76-mm!5F;document-file">abc</a>
To resolve this item you can open the Render Component Content template
Add below item under the <parameter> tag
(Where ExternalContentLibraryStubSchema-mm is the ecl schema title)
Note*: You can add any number of Schema identifiers of the Component Schemas that you want to expand, separated with a semicolon.
That’s it. Happy Sharing