Handling URLs as content
By Kyle Hatlestad on Jan 27, 2011
In building on a couple of earlier posts, I recently created a small component to further enhance the ability to handle URLs as content in UCM.
First, I wrote a post describing how to enable ‘Metadata Only’ as an option when doing a Check In. That is the first step in being able to handle URLs. Then I wrote a post describing how you can hide the Primary and Alternate File fields and default the check in profile page to do the ‘Metadata Only’ check-in.
So from a contribution perspective, this all works well.
But from a consumption perspective, it’s not handled very gracefully. By default, links on the search result page point to the Content Information page for the item. For metadata-only items, that makes sense. But when it’s a URL that is being managed, it would be nice if the link followed that URL. The other thing that happens is the file that gets created in the web location is a static HTML file which contains all of the metadata. Again, generally useful for metadata-only items, but not so much for URLs.
So I created an
custom component which does two things. First, it changes the links on search results for metadata only items to point to the web location just as standard content items do. Second, if there is a value in the URL metadata field, it changes the HTML page that is created to do a redirect to the URL specified. That means when a user clicks on the web location of the file in UCM, they are immediately taken to the location specified in the URL field. If the URL field is blank, the standard metadata only HTML page is generated.
The component has 2 parameters in the externalurl_environment.cfg file.
The ExternaURLField parameter identifies the metadata field used for the URL and LinkToInfoOnResults determines whether to link to the Content Information page or directly to the file on search results.
A nice side-benefit to doing it this way means that Content Tracker is able to track hits to these URLs. So just like with content, you can determine what URLs are most popular and which ones aren’t getting used.