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.
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 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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With