Thursday, May 16, 2019

Adobe Experience Manager (AEM) Link Transformer

I've been taught the wrong way to configure the Adobe Experience Manager (AEM) /etc/mappings in the past. There's zero documentation about how your URL, rendered from the Path Browser widget, gets Transformed to a relative URL hiding /content/sitename. Everyone says that the node name is important (it's not). So after spending an hour trying to sort this out, here's how it works.

You can create your own Link Rewriter by implementing the org.apache.sling.rewriter.Transformer interface. Adobe comes with one out-of-the-box that will use the Sling Mappings for Resource Resolution (a.k.a. /etc/mappings). The key is setting up your /etc/mapping correctly.

Here's an example of an /etc/mapping for a SSL (https) Site:


The OOTB Link Transformer will traverse your configured /etc/map directory from top to bottom, based on the node order. This is why setting the "jcr:primaryType" to "sling:OrderedFolder" is so important.

As it traverses the nodes, the first sling:internalRedirect regex that matches the link path will be used to rewrite the URL to what is set in the sling:match property. It uses the following values to rewrite the link:

  • Protocol is selected based on the parent http or https;
  • The regex grouping(s) that are created from the sling:internalRedirect property are used when rewriting the link; and
  • The link will be rewritten using a combination of the protocol and the sling:match regex.


This is why using a sling:OrderedFolder is so important. As all sites should be https; if we have multiple sites and domains, and we offer linking via AEM Path Browser between them, we need to configure the sites to create fully qualified URLs with https. Without an Ordered Folder, http configurations would be ordered above https and this wouldn't work. Same with doing multiple mappings within a protocol node.

Finally, whatever domain is configured to at the Dispatcher will be used as part of Link Transformer to match and write a relative path. So...

  • If your domain is bmxcode.com and that points to your reverse proxy;
  • Your domain bmxcode.blogspot.com points at your AEM instance; then
  • Set your "sling:match: property to "bmxcode.blogspot.com/$1" and this will rewrite your links as relative URLs (without the protocol and domain).


Hope this helps!

Friday, March 31, 2017

Adobe Activation Core Services (DTM) integrating with Adboe Experience Manager (AEM)

Adobe has rebranded their Dynamic Tag Manager (DTM) to now be called Activation Core Services.

There are two ways to integrate Adobe Experience Manager to Activation Core Services:
  • The Nice Way - Using Cloud Integrations
  • The Nasty Way - Adding the Head and Foot scripts directly to your templates.
I'm not going to go through the Nasty way, except that it's quick, dirty and, well, nasty!

Configuring it via Cloud Services you need to get your Marketing Cloud API token. To get this, you need to contact Adobe Client Care for API token by emailing clientcare@adobe.com.

https://helpx.adobe.com/dtm/kb/How_to_retrieve_API_token_for_DTM_account.html

Friday, October 28, 2016

Using Maven to create an RPM distribution

I've been digging around trying to find the minimum POM configuration to create an RPM distribution using Maven. Here it is for anyone else who needs it.

Friday, September 16, 2016

AEM Quick Tips

How to find the runmode
http://host:port/system/console/status-System%20Properties
Listed as sling.run.modes

How to find the version info
http://host:port/system/console/status-productinfo

Wednesday, August 24, 2016

Setting up an AEM 6.2 project with Archetype 10

Adobe hasn't released a new Archetype for Adobe Experience Manager 6.1 and 6.2, so the AEM dependancies have not been updated to use the aem-uber.jar. I noticed this when I extended WCMUse in 6.2 and it was not deprecated. This has been replaced by WCMUsePojo in 6.2. Here's what you need to do to get your AEM project working with aem-uber.jar.

Update the AEM dependency in the project root pom.xml file:

Update the referenced dependencies in the core, it.tests, ui.apps and ui.content module pom.xml files:

That should do it, now WCMUse is deprecated!

Thursday, July 28, 2016

Content Fragment Templates in AEM 6.2 means content centric sites!

Just had the opportunity to start digging through the AEM 6.2 changes, upgrades and improvements and I've stumbled across Content Fragment Templates. WOW! So many times I've seen, heard and been requested to be able to create Content Types and reuse content snippets in an easy and manageable fashion in AEM, and now it's possible.

Content Fragment Templates will allow us to create fragments of content, containing a combination of text, images and whatever we want, in a template format, with renditions, then drag and drop it into a page as if we were adding in an Asset. Great news for replying to every RFP that asks for this!

Check it out on the Adobe AEM Help:

https://helpx.adobe.com/experience-manager/using/content-fragments.html