Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Externalizing links not working for assets


Level 1



We have have implemented externalizer which works fine for all the links. However src property of images are not externalized. We do not conditionally externalize links.


For pages or image components that render within AEM it isn't much of a problem. However this becomes an issue with content fragments. The main reason we create a content fragment is to expose it to outside apps.


We have a content fragment which is exposed via the assets api to the react app. If we add and image into the Rich text editor, that image is not externalized making it totally useless to react app. 


Any thoughts on how this can be resolved?

4 Replies


Level 5

Hey guruprasadb9915, Have you tried creating a link transformer for this requirement? just target the <img> tag and update the <src> attribute and it will transform the src the way you want. Thanks!


Level 1

Hi bilala23933647,

Yes I have the link transformer configured. But I still do not see it transforming the img src even for html pages. Only the anchor tags are handled by Externalizer. Link transformer seems to be doing nothing.


link trans.JPG


However when I request the content fragment from Assets API, neither the anchor link nor the img src is externalised or re-written. This seems to be a fundametal requirement when we expect the content fragment to be consumed by other apps.


Also I am not a fan of using a JSON exporter (i mean mode.json). It just feels redundant to create a page for content fragment. I know I will run into caching issues (cant invalidate the cached content) if I dont create a page. What is the purpose of this asset API? It does not seem to help in any way.


Level 5

Hi @guruprasadb9915 , I don't understand why your default transformer is not coming to picture but if it still continues to do so, you can write a new custom LinkTransformer.

if (attributes.getIndex("src") == -1) {
attributes.addAttribute(StringUtils.EMPTY, "src", "src", "xs:string", "customSrc");

This will make sure that src is targeted while rendering the html.


Level 1
It will not solve the problem as link transformer or externalizer is not triggered when the request is made from assets api. I am not looking for a solution for HTML pages