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
BedrockMission!

Learn More

View all

Sign in to view all badges

Externalizing links not working for assets

Avatar

Avatar
Give Back
Level 1
guruprasadb9915
Level 1

Likes

0 likes

Total Posts

4 posts

Correct Reply

0 solutions
Top badges earned
Give Back
View profile

Avatar
Give Back
Level 1
guruprasadb9915
Level 1

Likes

0 likes

Total Posts

4 posts

Correct Reply

0 solutions
Top badges earned
Give Back
View profile
guruprasadb9915
Level 1

10-02-2021

Hi,

 

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?

Accepted Solutions (0)

Answers (1)

Answers (1)

Avatar

Avatar
Springboard
Level 4
bilal_ahmad
Level 4

Likes

66 likes

Total Posts

108 posts

Correct Reply

16 solutions
Top badges earned
Springboard
Validate 10
Validate 1
Ignite 1
Establish
View profile

Avatar
Springboard
Level 4
bilal_ahmad
Level 4

Likes

66 likes

Total Posts

108 posts

Correct Reply

16 solutions
Top badges earned
Springboard
Validate 10
Validate 1
Ignite 1
Establish
View profile
bilal_ahmad
Level 4

10-02-2021

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!

guruprasadb9915

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.

bilal_ahmad

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.

guruprasadb9915
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