the Tagcloud Module for Magnolia CMS
the easy way to build tag clouds with Magnolia CMS
Configuration and usage
Tagcloud module configuration
After installing the module you can configure your tagclouds under /modules/tagcloud/clouds node in the config jcr.
For each tagcloud you can define a name (the main node name, "tags" in the sample below) and the following properties:
- path the base path in the repository
- repository the repository (usually website)
- propertyName the name of the multivalue property (nodedata) holding the cloud values
Below is a sample screenshot:

Use tagcloud control in your dialogs
This method allows you insert a tagcloud control in your dialog.
You can provide a descripion, label and an optional width.
If you specify a tagCloudName property automatically the tagcloud name is attacched to configured tagcloud on /modules/tagcloud/clouds/mytagcloud.


Below there are api function to retrieve tagclouds.
If you use Freemarker as your favorite templating engine in Magnolia, now all the EL functions from the jsp taglibrary are also available to Freemaker templates, as static method using the "tagcloud" prefix.
For example, if in jsp you can do ${tagcloud:url(content)} you can do the following in freemarker templates: ${tagcloud.named('mytagcloudname')} (note the dot after "media").
Below a description of all elfunction.
${tagcloud:named('mytagcloudname')}
This function get a tag cloud configured in adminCentral (which caches values and updates on repository operations) with the name mytagcloudname.
Return a Map of tags, where key is the frequency and value is the tag name.
${tagcloud:cached('website', '/path/to/my/contens', 'tags', 20)}
This function create a tag cloud, cache it, and link it to repository events for updates.
Return a Map of tags, where key is the frequency and value is the tag name.
${tagcloud:notcached('website', '/path/to/my/contens', 'tags', 20)}
This function calculate tag cloud, without caching it. Each call to notcached will calculate tags from lucene indicies.
Return a Map of tags, where key is the frequency and value is the tag name.
Below functions to retrieve tagclouds data (tagCloud map is retrieve from previous elfunction):
${tagcloud:props(tagCloud)}
This function get a map with some properties of passed tag cloud: min which holds the number of hits for the less used tag, max which holds the number of hits for the most used tag.
Could be useful for normalization work.
${tagcloud:sortbyname(tagCloud, false)}
This function sort a tag cloud by tag names.
If the second parameter is true, the sort order is ascending otherwise descending.
${tagcloud:sortbycount(tagCloud, true)}
This function sort a tag cloud by tag count.
If the second parameter is true, the sort order is ascending otherwise descending.
See javadoc for details and code samples.
Use tagcloud tag in jsp template
Retrieve a tagcloud configured on modules node or in your dialog and create an html structure, than you add your css styles.
<tagcloud:tagcloud id="cloud3" name="tags" orderby="name asc" showFreq="true" />
Attributes are:
- name: tagcloud name
- repository: repository website or media
- path: path to search
- property: configured name
- count: max tags to display
- cache: true/false, tagcloud is cached
- id: css id assigned to ul container
- cssclass: css class assigned to ul container
- steps: number of steps between the tags
- cssprefix: prefix for css class attacched to tag
- url: if set generate the url on tags
- showFreq: show tag frequency
And the generated code is like:
<ul class="tagcloud" id="cloud3"> <li class="tag tagsize1">custom (1)</li> <li class="tag tagsize6">hello (2)</li> <li class="tag tagsize1">hello world (1)</li> <li class="tag tagsize11">openmind (3)</li> </ul>
If url is setted the tag is surround by tag anchor element <a>.
After a basic css style you can obtain a tagcloud showed below.

Advanced Lucene configuration
Lucene by default indexes only singles words, but the configuration showed configure lucene index to work with spaces.
The index configuration file works with jackrabbit 2.1.0, without indicate absolute path, because jackrabbit search on the classpath.
For previous version of jackrabbit (like 1.5.x), you must indicate the absolute path on your configuration xml.
The following sample configuration allows insert space inside the tags.
indexing_configuration.xml:
<!DOCTYPE configuration SYSTEM "http://jackrabbit.apache.org/dtd/indexing-configuration-1.0.dtd">
<configuration xmlns:nt="http://www.jcp.org/jcr/nt/1.0">
<analyzers>
<analyzer class="org.apache.lucene.analysis.KeywordAnalyzer">
<property>tags</property>
</analyzer>
</analyzers>
</configuration>
And then in your jackrabbit datasource, value of indexingConfiguration is an absolute path:
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
<param name="indexingConfiguration" value="/indexing_configuration.xml" />
[...]
</SearchIndex>
In an easy way the module provide to catch the correct indexing configuration from packages.
Project info & quick links
-
Latest release: 1.1.0
License: GPLv3 - Download Sourceforge file download area
- Bugs and feature requests OpenmindLAB Jira
- Changelog See what's new in release 1.1.0
- Source code Subversion public url
- Javadocs Documentation for the release 1.1.0
- Taglibdoc Documentation for tags and EL functions
- Maven The dependency snippet for your pom