Configuring preview filters for Visual mode in AEMaaCS
Note
If you are using Adobe Experience Manager 6.5 (AEM 6.5), see Configuring preview filters for Visual mode in AEM 6.5.
A problem can occur in Visual mode if a source content page contains in-line references to files that should not be sent to XTM Cloud with that source content page, and used for generating a preview. Sometimes, It is also necessary to be prevent certain types of source content file from being sent to XTM Cloud for translation.
Example
A source content page contains a reference to a nested REACT application that relies on dynamic data pulled from a REST API. This prevents the preview from being displayed. In such a case, you might need to filter out the scripts that break the page rendering.
Excluding unwanted file types or files
To resolve problems of this kind, you can define reference filters to exclude specific file types, or files in specific locations, so they are not sent to XTM Cloud with or as translatable content. To do so, use regular expressions (also known as "regex").
Important
We strongly recommend that you use OSGi configuration files to define these reference filters, instead of manual configuration, whenever possible. For details, see Configuring OSGi for Adobe Experience Manager as a Cloud Service | Adobe Experience Manager.
The next procedure nevertheless describes the manual procedure anyway, for completeness.
Note
Escaping reserved characters in regex strings
In any OSGi Preview mode configuration file that you create, ensure that you escape reserved characters correctly.
Example: the $ sign is a reserved character and must be escaped with a backslash, like this: \$.
Regex patterns are very powerful and can be very greedy too. When you define them, ensure that they are strict enough and do not select too many items. We strongly advise that you work on Preview Configuration in a localhost environment, to ensure a swift development phase. Working with regex can mean a lot of trial and error.
On your localhost, in your instance of AEM as a Cloud Service, open the OSGi Console ((access /system/console/bundles) path).
Select Configuration Manager (system/console/configMgr path). The Configuration Manager is displayed in the Configuration tab screen.
To find the XTM Preview Configuration section, search for service PID "com.xtm.aem.services.translation.preview.XtmPreviewConfig". Then select it, to edit the configuration values in it. You can make five different sets of settings, described in the table below:
Replacement match patterns: use this setting to define replacement match patterns with which to identify content that is to be changed in preview files, when they are received in XTM Cloud.
Replacement strings: this setting works with the previous setting: use this setting to define strings to replace the match patterns defined in the previous setting with specific content, in preview files that have been received in XTM Cloud.
Reference filters: to ensure that only relevant reference files are sent to XTM Cloud, use this setting to filter in-line references to other files, in source content files. For details, see the Reference filter Preview filter type in the table below.
Custom HTML reference patterns: use these patterns to define custom regular expressions that extend a preview package by including additional assets. You can specify asset types and locations to be included. For details, see the Custom HTML reference pattern Preview filter type in the table below.
Force include client library categories: use this setting to specify whether particular client libraries should always be included in preview packages. For details, see the Force include client library categories Preview filter type in the table below.
Preview filter settings
Warning
In some of the settings described below, you can enter regular expressions (regexs). If you define an invalid regular expression, it will not be taken into account. For troubleshooting, you will find a WARN message about it in the logs.
Make these settings, if required:
Warning
If you define an invalid regular expression, it will not be taken into account. For trouble-shooting, you will find a WARN message about it in the logs.
Entry field | OSGI field name | Description | Examples |
|---|---|---|---|
Replacement match patterns | replacement.match.patterns |
| See XTM Workbench Path variable customization for Visual mode. |
Replacement strings | replacement.strings |
| See XTM Workbench Path variable customization for Visual mode. |
Reference filters | reference.filters |
| Reference filter examples
|
Custom HTML reference patterns | custom.html.reference.patterns |
| Custom HTML reference pattern filter example
|
Force inclusion of specific client library categories | force.include.client.library.categories | Client libraries are grouped in categories. To specify that the libraries in a particular category must always be included in preview packages, enter their names in this setting. They will then be included, regardless of whether they are referenced in the markup or not. | / |
Note
For details of other Visual mode-related topics, see Configuring Visual mode in AEMaaCS.