Work with friendly URLs for web content

With friendly URLs for web content, you can construct URLs to content items that are clear and concise, making the URLs easier for users to remember and share. Friendly URLs for web content are a convenient way for users to create bookmarks to content items or for external applications to provide links directly to content items in the portal. To ensure that you create friendly URLs for web content effectively, it is important to understand how friendly URLs for portal pages are constructed and how friendly URLs for web content extend the portal friendly URLs.


How friendly URLs for pages work

For a page to be referenced as part of a friendly URL, assign a friendly URL name for the page. You can do this when you create the page, or you can use Manage Pages to edit the page properties after the page is created.

Friendly URLs take the following general form:

The page_id portion of the friendly URL is made up of the friendly URL names of each page in the page structure from the content root to the currently selected page.

For example, you might have a portal page called Products with a friendly URL name of products, and underneath the Products page is another page called Appliances with a friendly URL name of appliances. When referenced as a complete friendly URL, you would enter the following URL to access the Appliances page:

For friendly URLs to work for a specific page, define a friendly URL name for each page or label in the page hierarchy from the specific page back up to the content root. To suppress a friendly URL name from appearing in the friendly URL, you can specify a friendly URL name of com.ibm.portal.friendly.wildcard for the page. For example, if the Products page has a friendly URL name of com.ibm.portal.friendly.wildcard, the friendly URL above for the Appliances page is abbreviated:

When the portal displays a page using a friendly URL, the URL might also include an encoded suffix at the end of the URL that takes this form: !ut/p/base_codec/rich_state. This suffix contains information about the portal's state that the portal might use when displaying the page. However, when bookmarking or sharing friendly URLs, it is not necessary to include the suffix.


How friendly URLs for web content work

Friendly URLs for web content are constructed just as friendly URLs for pages but include additional information that identifies the path to a content item. When the portal decodes a friendly URL, it decodes the URL from left to right, matching each path segment of the URL to the friendly URL names of portal pages until it can no longer find a match. The remainder of the URL is then considered to be path information to a content item and is mapped to a shared public render parameter that is scoped to the portal page identified by the URL. The fully qualified name of this path-info parameter is http://www.ibm.com/xmlns/prod/websphere/portal/publicparams:path-info. The path-info parameter can contain multiple values, with the individual values representing segments of a content path that are concatenated using a forward slash (/) as a path separator.

Friendly URLs for web content take the following general form:

When you add a JSR 286 web content viewer to a portal page, the web content viewer reads the path-info parameter and assembles the path to the content to be rendered by appending the path information to the content mapping defined for the current page. For example, you might have the following friendly URL for web content:

Several conditions contribute to this URL:

When a JSR 286 web content viewer is added to the Appliances page, the web content viewer interprets the path-info information from the friendly URL and identifies welcome as path information that represents content in a web content library. By examining the content mapping on the page, the web content viewer locates the Web Content/Appliances site area and then displays the site area's default content, which is the welcome content item.

When setting up the portal page hierarchy and web content hierarchy, ensure that naming schemes for each do not overlap in such a way that the path_to_content information starts with segments that could be part of the page_id portion of the friendly URL. Because the page_id portion of the friendly URL is always evaluated first, the friendly URL could inadvertently point to the wrong page, if the first segment of the path_to_content information matches the friendly URL name of a portal page at that point in the page hierarchy.

Considerations for the path-info parameter:


Troubleshooting friendly URLs for web content

If you are seeing unexpected behavior when using friendly URLs for web content, review these issues to help identify why the friendly URL is not working:


Parent

Friendly URLs and web content viewers

Related

Coordination with other JSR 286 portlets

December 14, 2011
   

 

Apr 1, 2011 1:26:17 PM

});


+

Search Tips   |   Advanced Search