Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sling:alias vs vanityUrl in AEM

what is the main difference between vanity url and sling:alias?

as per docs : here

sling:alias – The property 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.

Vanity URL - You define Vanity URLs in CQ to create easy-to-remember and easy-to-search URLs on your website.

But still I can not sure what exactly is the difference and when do we use them. Please help me out in this.

like image 663
Manan Kapoor Avatar asked Mar 22 '16 06:03

Manan Kapoor


People also ask

What is sling alias?

sling:alias – The property 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.

What is vanity URL in AEM?

Vanity URLs are like shortcuts. Shorter or unique URLs that reference where the real content lives. An example: /aboutus pointed at /content/we-retail/us/en/about-us.html. AEM Authors have the option to set vanity url properties on a piece of content in AEM and publish it.


1 Answers

I think that the main difference is that with sling:alias you may set just other name where the resource is available (note name, but not path) and with sling:vanityPath you define absolute virtual path to access this resource. So for example if you have the following structure:

content
└── visitors(sling:alias=besucher, sling:vanityPath=/besucher)
    └── area(sling:alias=bereich)
        ├── a(sling:vanityPath=/bereich/a)
        └── b(sling:alias=c,sling:vanityPath=/bereich/b)

You can access the above pages also in the following ways:

/content/besucher.html -> /content/visitors
/content/besucher/area.html -> /content/visitors/area
/content/besucher/bereich.html -> /content/visitors/area
/content/besucher/area/a.html -> /content/visitors/area/a
/content/besucher/area/b.html -> /content/visitors/area/b
/content/besucher/bereich/a.html -> /content/visitors/area/a
/content/besucher/bereich/b.html -> /content/visitors/area/b
/content/besucher/bereich/c.html -> /content/visitors/area/b
/besucher -> /content/visitors
/bereich/a -> /content/visitors/area/a
/bereich/b -> /content/visitors/area/b
like image 126
d33t Avatar answered Oct 13 '22 01:10

d33t