Attention

This document was written for an unsupported version of Plone, Plone 2.1.x, and was last updated 1240 days ago.

For more information, see the version support policy.

To learn how to upgrade to the current version of Plone, read the upgrade manual.

How to Add a Hyperlink Listing of Keywords to the Top of Your Documents

by Shane Graber last modified Dec 30, 2008 03:02 PM
This howto explains how to add a hyperlink listing of keywords to the top of your content items. In this example, I will add this list to the top of all Documents.

Add this code to your 'document_view' template right below the 'div class="documentDescription"' section:

<div id="keywords-list"
tal:define="keywords here/Subject"
tal:condition="keywords"
tal:on-error="string:">
Keywords:

<tal:loop tal:repeat="keyword keywords">

<a href="" title="Click to search"
tal:attributes="href python: context.portal_url() + '/search?SearchableText=&Title=&Subject%3Alist=' + keyword + '&Description=&created%3Adate=1970%2F02%2F01+00%3A00%3A00+GMT&created_usage=range%3Amin&Creator=&submit=Search'"
tal:content="keyword" /><span tal:define="last repeat/keyword/end"
tal:omit-tag=""
tal:content="string:, "
tal:condition="python: not last" />
</tal:loop>
</div>

Now any keywords you add to your content will be shown as a hyperlink keyword index at the top of your document. To find additional information out about a specific keyword, all a reader has to do is click on the link and the portal is searched for that specific keyword.

Here's a screenshot of the results:

A live example can be seen at AdvancedAquarist.com as well as surfing around the site.


Contribute

Something wrong or out of date? Anybody can edit or create a new article in the knowledge base. Simply create an account on this site, log in, and click the Edit button to contribute.