Skip To Content

Search Results 'Share' Link

In this topic

Customize Search Results with a 'Share' Link for Sharing Records

This customization enables a Share link for each metadata record that appears in the search results page. The Share link allows users to bookmark (i.e., Add to Favorites) or share (i.e., through Digg, MySpace, Google, etc.) a particular metadata record directly from the search results page using technology from AddThis.

Follow the steps below to add the Share link to the Geoportal Implementation. To perform this customization, access to the Geoportal .jsp files on the Geoportal web application server is necessary.
  1. Navigate to the \\geoportal\catalog\search folder.
  2. Open the results.jsp file in a text editor.
  3. At the top of the file, you will add some javascript. Find the first <f:verbatim> tag, and add the following lines just beneath that f:verbatim tag:
    <script type="text/javascript" src="http://s7.addthis.com/js/200/addthis_widget.js">
    <script type="text/javascript">
                    var addthis_pub=" ";
    </script>
  4. Now, find in the results.jsp file where the <% // Resource links %><h:panelGroup> output links are defined. Add a new < h:outputLink> section, right above the line that starts with <% // Zoom map, that has the following code:
    <% // Share result %>
    <h:outputLink id="_lnkShare" rendered="#{record.viewMetadataUrl != ''}"
                   value="http://www.addthis.com/bookmark.php?v=20" styleClass="resultsLink"                onmouseover="return addthis_open(this, '', '#{record.viewMetadataUrl}', '#{record.title}')"onmouseout="addthis_close()" onclick="return addthis_sendto()">
                    <h:outputText id="_txtShareThis" value="#{gptMsg['catalog.search.searchResult.share']}" />
    </h:outputLink>
  5. Save the results.jsp file and close it.
  6. Navigate to the \\geoportal\WEB-INF\classes\gpt\resources folder. Open the gpt.properties file in a text editor.
  7. Add the following resource key under the # search related pages heading. The resource key is the name of the link that appears in the search results user interface. Replace the text after the equals sign with a title for the link (Share in the example below):
    catalog.search.searchResult.share = Share
  8. Save the gpt.properties file and close it.
  9. Restart the geoportal web application, and do a search to see the new Share link in each search result.