Example 2: Generate a friendly URL for web content
This example demonstrates a content URL generation filter that generates a friendly URL for web content.
The filter determines the target portal page used to render the web content. If there is a web content page that has a content association that references a parent site area of the content, the filter writes out a friendly URL to the content.
Friendly URLs for web content are constructed according to a several factors. For example, the friendly URL /wps/myportal/home/news/news+1 is determined by the following details:
- Content path: /Library1/News/News 1
- Content association the web content page where the content is rendered: /Library1/News site area
- Friendly URL of this page: /home/news
To use the sample filter that is described here, each page for which a content URL is generated must have these characteristics:
- The page must be a web content page with a friendly name.
- The page must have a default content association that references the parent site area of the content item.
The friendly URLs that are generated by this sample filter do not contain any portlet state information. When a user clicks one of these friendly URLs from within a web content viewer that does maintain state information, the state information in the viewer is cleared.
Important: These sample filter classes are not provided by default with Web Content Manager. Example code is provided here that we can take and use to implement the classes yourself.
- Example 2: Filter factory class
This sample demonstrates a filter factory class. This filter class creates an instance of the filter for each request to render web content containing URLs to other web content items.
- Example 2: Filter class
This sample filter generates the friendly URL.
- Example 2: plugin.xml file
We can use this sample plugin.xml file to register the sample filter.
Parent: Create a content URL generation filter classRelated: