Web content viewers
Web content viewers are portlets that render content from a web content library as part of a portal page. If the presentation is simple, a single viewer can be sufficient. To provide a richer experience for the users, use multiple viewers to aggregate content from different libraries.
How viewers locate content
When we add a web content viewer to a web content page, the viewer locates the content to be rendered by evaluating several pieces of information:
- The portlet configuration settings for the viewer can identify the default content to be rendered when a user navigates to a page containing the viewer.
- If the viewer does not specify default content, it determines whether a default content association is defined for the page. If a content association exists, the viewer renders the default content of the referenced site area in IBM Web Content Manager.
- If the current request contains a public render parameter (path-info or context), the viewer renders the content identified by the render parameter. This setting overrides the content setting from the portlet configuration or from the content association the page. An example of a case where a render parameter might be involved is when users click a link to a content item.
When determining which content to render, a web content viewer checks first for a render parameter on the request. As shown in Table 1, if no parameter exists, the viewer evaluates its own portlet configuration and any content association the page containing the viewer.
Content reference in portlet configuration? Content association on web content page? Content rendered by viewer Yes No Content identified by portlet configuration of the viewer. No Yes Content identified by association on page. Yes Yes Content identified by portlet configuration of the viewer. The content specified in the portlet configuration can use a relative path. In this case, the complete path to the target content is derived by combining the associations on the page and the viewer.
References to content can be direct or relative:
- Direct path to the target content
- A web content viewer can reference either a site area or a content item.
Library/SiteArea/Content
For example...
News/Articles/Article
When you configure the viewer with a direct path to content, the content association the page containing the viewer is ignored.
To configure a direct path to content, use the Select content and path setting in the Content behavior settings of the web content viewer.
- Relative path to the target content
- When deriving a content path based on a relative path, the viewer appends the content path in its configuration to the content association on the page. For example:
- Content association on web content page: Web Content/Articles
- Content referenced in portlet configuration: Article
- Resolved content path: Web Content/Articles/Article
To configure a relative path to content, use the Select content and use the content association of current page setting in the Content behavior settings of the web content viewer.
Depending on how you reference content, we can create web content viewers and web content pages that are as specific or generic as you require.
- Reference no content
- We can define a content association on a web content page and then add a generic viewer that references no content. The viewer detects the site area defined by the content association the page and renders content from the site area. No additional configuration of the web content viewer is required.
- Reference specific content
- We can configure a viewer to point to a specific piece of content. We can then add this viewer to any web content page to render the mapped content, regardless of any content association the page.
- Reference content with a relative path
- If we are using a consistent site structure with the web content libraries, we can take advantage of the relative path capability for referencing content. For example, we can create a reusable viewer that can render different content depending on the web content page where the viewer is deployed. By defining a viewer with a content association that uses a relative path, we can add instances of that viewer to different pages. The viewers then render different content, according to the content associations on the pages.
- We can use one content association on a page and then add multiple web content viewers on the page. In this case, the web content viewers are configured to use a relative path into different site areas in the library. By changing only the content association the page, we can then redirect the viewers to another library or other set of site area content.
Create content with web content viewers
When added to a page, a viewer can create a copy of the content identified in the portlet configuration. This feature provides several advantages:
- We can create content items quickly and easily, within the scope of the page where they are used.
- We can modify the individual copies of the content independently of each other.
- Typically, there is no need to further adjust the configuration of the viewer after we add it to the page.
Web content viewers configured to create content can be used multiple times, either on the same page or on different pages. Each instance of the viewer references a separate copy of the content item referenced in the portlet configuration.
Copied content is stored in the site area identified by the default content association of the current page. In addition, the portlet configuration of the newly added viewer is automatically updated to specify a relative path to the copied content.
Link web content viewers
Many web content viewers can be added to a single portal page or a series of pages. Sometimes it is necessary for different web content viewers to interact with each other. For example, a menu component might be placed in one viewer and a content item in another viewer. The content item to change when a different link is clicked in the menu, link the two viewers.
Web content viewers can broadcast or receive links:
- Broadcasting links
- The state or context of a web content viewer is not sent directly from one portlet to another. We can configure viewers to broadcast their current state or context to other viewers on the same page or to viewers on other pages. Any information broadcast by a web content viewer is received only by viewers that are configured to receive this information.
- Receiving links
- A web content viewer can receive the following information
- Information about the state or context of the current content item or component being rendered by the viewer.
- Information from content items or components rendered by other viewers that are broadcasting links.
For examples of the different ways that we can use linking with web content viewers, see Link examples for web content viewers.
Web content viewers and remote servers
To display web content on a portal that does not include Web Content Manager, we can use web content viewer and WSRP.
Parent: Get started with delivering web content on a portal pageRelated:
Related:
Perform remote rendering with WSRP and the web content viewer
Related reference: