Tags and Categories
Tags and Categories are a way of organizing and aggregating content.
The tagging system provided by default by Liferay supports both taxonomies and folksonomies. Folksonomies are represented by tags and Taxonomies are represented by categories, which means that tags are freeform (any user can add new tags) whereas categories are declared before and the user can only select from a set. Categories can be classified in vocabularies and from version 6 they can be hierarchical.
Which content can be tagged or categorized? #
The Assets. Any content can be tagged or categorized as soon as it has an asset associated. Most of the contents of the portal have this by default, but it can also easily implemented for you own type of contents (even from a plugin).
Contents that can be tagged or categorized in the core:
- Blog Entries
- Web Content
- Message Boards Messages
- Wiki Pages
- Images from Image Gallery
- Any Document from Document Library
- Shopping Cart products
- Knowledge Base Articles (Plugin)
- Organizations and Communities
How can I make my contents taggable and categorizable? #
In order to use Liferay tags and categories, you just need to create an Asset for each of your contents. Have a look at AssetEntry.java for more details about it (from version 6) or TagsAsset (version 5.2 and below).
What tools does Liferay offer me? #
You can use the following liferay taglibs and portlets.
- Taglibs (can be used in your own portlets):
- Categories Navigation . Allows the user to navigate using categories (<liferay-ui:asset-categories-navigation>).
- Tags Navigation. Allows the user to navigate using tags (<liferay-ui:asset-tags-navigation>).
- Categories Selector . Allows the user to select categories (<liferay-ui:asset-categories-selector>).
- Tags Selector . Allows the user to select tags (<liferay-ui:asset-tags-selector>).
- Categories Summary . Displays a summary of the categories of a content (<liferay-ui:asset-categories-summary>).
- Tags Summary . Displays a summary of the tags of a content (<liferay-ui:asset-tags-summary>).
- Portlets (can be used in a page and provide inter-portlet communication using public render parameters).
- Asset Publisher: Allows you to filter and disply content depending on the tags or categories that the content has or hasn't in a very flexible way.
- Categories Navigation: Allows the user to navigate using categories.
- Tags Navigation: Allows the user to navigate using tags.
- Tag Cloud: Allows the user to navigate using tags. Tags are displayed with different sizes depending on the number of times that each tag has been used.
Several portlets can use the tags and categories navigation portlets to filter their results. For example, asset publisher, wiki or knowledge base will display results based on the user navigation.
Can I make my own type of contents show up in Asset Publisher ? #
Yes! using the Asset Renderer Framework. You just need to create the Asset for each of your contents and implement the interfaces AssetRenderer.java and AssetRendererFactory.java
Managing Tags and Categories #
From version 6, you will be able to find two new portlets in the section Content of your Control Panel: Tags Administration and Categories Administration. In version 5.2 there is only one portlet called Tags and Categories.
Tagging your Content#
Whether you are creating a Blog, Journal Article, Message Board Entry, or Wiki you will notice the categories selector and tags selector to tag and categorize your content. These selectors can be easily added to your own forms using the taglibs explained above and the values will be automatically read if you use the ServiceContext Pattern.