Applies to Pega Platform 7.3.1-8.6
This article provides answers to Frequently Asked Questions about URL Mappings. The article also outlines the concept of Canonical URL and the utility of URL Mappings.
Answers to Frequently Asked Questions
- I have created URL Mappings. What is the reason for the failure of my Simple URL?
- How to determine which URL Mappings instance is picked?
- How to verify if an environment is a multitenant environment?
- Where is the mapping defined for the Canonical URL generation?
- How to find the Canonical URL for a given class?
- Is it possible to work with different work objects using Simple URLs on different tabs of a browser?
Introduction
Unreadable components such as AccessGroup hash, Thread name, and so on in the Pega URLs make it difficult to share the URLs. It is challenging to share the URLs because of the following reasons:
-
The URLs are ugly and lengthy.
-
The URLs provide too much internal information.
-
The URLs are complex and difficult to comprehend.
-
The URLs do not copy and paste well because of the dependency on the space availability.
-
The URLS do not help in Search Engine Optimization (SEO).
In such cases, Canonical URLs that are simple, short, meaningful, and self-explanatory may be used. To support Canonical URLs (Simple URLs), Pega has developed a new Rule type, URLMappings (Records > Technical > URL Mappings).
Canonical URL
A Canonical URL is the URL of the page that the browser considers as the most representative from a set of duplicate pages on the site. For example, if there are a number of URLs for the same page (for example, example.com?dress=1234 and example.com/dresses/1234), the browser selects one as Canonical. Note that the pages do not need to be absolutely identical; minor changes in sorting or filtering of list pages do not make the page unique (for example, sorting by price or filtering by item color).
URL Mappings
The URL Mappings rule defines simple URL patterns that can be used in an application for the work items (cases), reports, landing pages, and so on.
You can represent your work items with simple and short URLs so that you can easily share the work items with other users of the same Pega Platform application. Simple, meaningful, and readable URLs make it easier for users to collaborate.
You can also specify the patterns to generate Canonical URLs for your case types. Canonical URLs improve Search Engine Optimization because they prevent duplicate content issues by indicating the preferred (standard) URL version. By generating Canonical URLs for a case type, you can make all instances of this case type searchable by third-party search engines.
Answers to Frequently Asked Questions
I have created URL Mappings. What is the reason for the failure of my Simple URL?
URL Mappings is a rule where only one instance exists for a ruleset. If you have access to multiple rulesets and the URL Mappings instance is created in multiple rulesets, the instance of the first ruleset is selected.
A Canonical URL (Simple URL) fails because of the following reasons:
-
If the environment is a multitenant environment, Pega does not support Canonical or Simple URLs.
-
The URL Mappings instance resolved during runtime differs from the instance that has the Mapping definition.
How to determine which URL Mappings instance is picked?
Only one instance of URL Mappings can be created in one ruleset. Hence, the mapping of the instance that is created might be different from the one that is selected during run time.
To determine the instance that is chosen, perform the following procedure:
-
Create an activity in Dev Studio.
-
Add URLMappingsPage with class name as Rule-URLMappings in Pages & Classes.
-
Add the Obj-Open step with URLMappingsPage as Step page and .pyRuleName=’pyDefault’ as keys.
-
Add Show-page step with Step page as URLMappingsPage.
-
Run the activity. Verify if pyRuleSet and pyRuleSetVersion are present in the result. Simple URLs present in the pyDefault rule in pyRuleSet and pyRuleSetVersion are selected at run time.
How to verify if an environment is a multitenant environment?
An environment is multitenant if the value of the pyIsMT property on the pxAdminSystem Clipboard page in System pages is true. This is illustrated in the following figure:
Where is the mapping defined for the Canonical URL generation?
Add the Canonical URL definition in the URL Mappings instance.
For more information, refer the following articles:
How to find the Canonical URL for a given class?
Use the SimpleURL.pxGetSimpleURLByClass Rule Utility Function (RUF) to find the Canonical URL for a particular class. Use the SimpleURLpxGetSimpleURLByAlias RUF for a Simple URL by URL alias.
Canonical URL can be obtained by the following two ways:
-
Using SimpleURL.pxGetSimpleURLByClass RUF
-
Using SimpleURLpxGetSimpleURLByAlias RUF
Using SimpleURL.pxGetSimpleURLByClass RUF
Generate Simple URL using the Clipboard page.
The SimpleURL.pxGetSimpleURLByClass RUF runs the following steps:
-
Accepts the Clipboard page
-
Fetches the appropriate URL Mappings by matching the Clipboard page’s class name (pxObjClass) with the associated classes
-
Generates Simple URL by replacing the Clipboard property values
This RUF accepts the following two parameters:
-
Clipboard page that is used to generate Simple URL
-
A Boolean value that indicates if there is a requirement to generate absolute form of Simple URL
Using SimpleURLpxGetSimpleURLByAlias RUF
Generate Simple URL using the alias name provided and the Clipboard page.
The SimpleURLpxGetSimpleURLByAlias RUF runs the following steps:
-
Accepts the alias name and the Clipboard page
-
Fetches the appropriate URL Mappings by matching the alias name provided
-
Generates Simple URL by replacing the Clipboard property values
This RUF accepts the following three parameters:
-
Alias name of URL Mappings
-
Clipboard page that is used to generate Simple URL
-
A Boolean value that indicates if there is a requirement to generate absolute form of Simple URL
The RUF returns a short URL if you have any URL Mappings defined with the alias name provided. If not, the RUF returns null.
Is it possible to work with different work objects using Simple URLs on different tabs of a browser?
Any work object can be accessed by Simple URLs. Issues occur when you edit different work objects that are open on different tabs of a browser. This happens because the Simple URLs work on the Standard thread. Pega has addressed this issue in Pega 8.5 and later releases by opening Simple URL in a random thread content instead of using the Standard thread.