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

Issue Using sling:alias to get url translated

Avatar

Level 2

Hello Community,

 

I have following situation 

 

/content/xyz/en/application/test.html

|                                           sling:alias = mytesten

|

|

/content/xyz/fr/application/test.html

                                          sling:alias = mytestfr

 

with these alias set i am able to access /content/xyz/fr/application/mytestfr.html

 

I also have alias for application under fr node set to myapplicationfr

Hence i am able to access /content/xyz/fr/myapplicationfr/mytestfr.html as well.

 

However, when selecting the page using pagefield component  in the dialog which would show the pages to select, the url which gets linked is only /content/xyz/fr/application/mytestfr.html instead of /content/xyz/fr/myapplicationfr/mytestfr.html

 

Has any one faced this situation of not able to resolve the sling:alias for parent pages in the path for a CTA?

 

Thanks

2 Replies

Avatar

Community Advisor

Hi @arungm20 

 

The property sling:alias may be set on any resource to indicate an alias name for the resource. For example the resource /content/visitors may have the sling:alias property set to besucher allowing the resource to be addressed in an URL as /content/besucher as well as the original path /content/visitors.

 

So you will not able to directly browse alias path using pathfield from dialog, you need to explicitly add alias path the way you want to have it for CTA. 

 

For more info:
https://sling.apache.org/documentation/the-sling-engine/mappings-for-resource-resolution.html 

https://www.javacodexamples.com/examples/slingalias-vs-vanityurl-in-aem 

 

Hope this helps.

 

 

Avatar

Level 2

Thanks @Siva_Sogalapalli 

I do have sling:alias in the path  /content/xyz/fr/application/test.html

i.e

test -> mytestfr as sling:alias

application -> myapplicationfr as sling:alias

 

However pagefield component is able to resolve only the last path i.e test for alias and not for application

 

Any views or you have come across this situation?

 

Thanks

Arun