Friendly URL for web content example
This example demonstrates how friendly URLs for web content work in conjunction with multiple JSR 286 web content viewers on a single portal page. The example describes the portal page structure referenced by the friendly URLs and explains the underlying structure of the content in a Web Content Manager site framework, along with the configuration of the web content viewers.
Set up the example
The example is composed of the following elements:Portal page hierarchy
The portal page hierarchy in this example looks like this:
Content Root > Home > Human Resources
The page Home has a friendly URL name of home, and the page Human Resources has a friendly URL name of hr. The pages can be accessed directly using the following friendly URLs for pages:
- http://www.example.com:10039/wps/portal/home
- http://www.example.com:10039/wps/portal/home/hr
Web Content Manager site framework
The Web Content Manager site framework resembles the portal page hierarchy:
Web Content (Web content library) > Home (site area) > Human Resources (site area) > HR Welcome (content item) > Health (site area) > Workplace Safety (content item) > Personal Wellness (content item) > HR Menu (menu component)
These content items can be referenced by the following content paths:
- Web Content/home/human resources/hr welcome
- Web Content/home/human resources/health/workplace safety
- Web Content/home/human resources/health/personal wellness
The menu component HR Menu is defined to display content from the human resources and health site areas.
Content mapping
The portal page Human Resources contains a content mapping to the Web Content/home/human resources site area.
JSR 286 web content viewers
The page Human Resources contains two instances of the JSR 286 web content viewer, Web Content Viewer A and Web Content Viewer B.
- Web Content Viewer A displays the menu component HR Menu and is configured to broadcast links to this portal page.
- Web Content Viewer B inherits the content to display from the content mapping defined for the page Human Resources and is configured to receive links from other portlets and from itself.
Browsing the content
With the portal page and web content site framework defined as above, browsing the content demonstrates how the different elements interact:
- Navigate to Human Resources page for the first time.
- URL displayed in browser's address bar: http://www.example.com:10039/wps/portal/home/hr/!ut/p/b1/...
- The URL reflects the friendly URL names of the portal pages Home and Human Resources.
- Web Content Viewer A renders the menu component and displays links to the content items HR Welcome, Workplace Safety, and Personal Wellness.
- Web Content Viewer B shows the default content item HR Welcome from the site area Human Resources, because of the content mapping defined on the portal page.
When the portal page is first displayed, the path of the default content item is not included in the friendly URL.
- Click Workplace Safety from the list of content items.
- URL displayed in browser's address bar: http://www.example.com:10039/wps/portal/home/hr/health/workplace%20safety/!ut/p/b1/...
- Web Content Viewer B displays content item Workplace Safety.
- The URL is adjusted so that the path to the content item (health/workplace%20safety) becomes part of the URL.
Although special characters are allowed in content item names, special characters cannot be used in URLs. For this reason, the content item path shown in a friendly URL for Web content is URL-encoded. For example, a space character in the URL would be replaced by its URL-encoded equivalent: %20. Some web browsers perform automatic decoding of the URL, so you might see unencoded characters in the URL, but the portal always works with an encoded version of the URL.
- Click HR Welcome from the list of content items.
- URL displayed in browser's address bar: http://www.example.com:10039/wps/portal/home/hr/hr%20welcome/!ut/p/b1/...
- Web Content Viewer B displays the content item HR Welcome again. This gives the same result as when the portal page was viewed for the first time.
- Because Web Content Viewer A is broadcasting the link to the content item, the URL displayed in the browser is updated to reference the path to the content item (hr%20welcome).
Referencing content items with friendly URLs for web content
Although the URL displayed in the web browser can sometimes include the content item path when you browse pages and content with web content viewers, you can also reference content items directly in friendly URLs for web content.For example, to reference the content items HR Welcome, Workplace Safety, and Personal Wellness in the context of the Human Resources page, you would use the following friendly URLs for web content:
- http://www.example.com:10039/wps/portal/home/hr/hr%20welcome
- http://www.example.com:10039/wps/portal/home/hr/health/workplace%20safety
- http://www.example.com:10039/wps/portal/home/hr/health/personal%20wellness
These friendly URLs for web content include URL-encoded space characters (%20) instead of unencoded space characters. Although web browser might accept unencoded space characters when specifying content item names in friendly URLs for Web content, using the URL-encoded value ensures consistent behavior from the portal.
Friendly URLs and web content viewers
Related
December 14, 2011
Apr 1, 2011 1:26:17 PM
});