Color Paper by cohdra17 at Morguefile.com

Plone 4: Updating Portlet Templates

I don’t recall my first Plone version but since at least Plone 2 I have been using customized portlets. Initially, I started by using the News portlet and customizing it to show other types of content. When I started to try to use Plone for blogging and created a new content type based on News, the News portlet was easily copied to create a Blog portlet. Then I tweaked it a bit to show the new blog content type. When I migrated to Plone 3, I had to update the portlet but it was mostly just additional tweaking. Plone 4 appears to have changed the portlet scheme further, so the numerous portlet templates that I have customized no longer work. Here’s how I recreated the blog portlet using the built-in portlet framework.

Create an RSS Portlet

The easiest solution was to use the readily available Plone RSS function.  Since you can syndicate all sorts of content into RSS feeds on a Plone system, I figured I would just add an RSS portlet using the RSS feed for my blog folder.  I was already using this portlet to display my Twitter feed as well as blog postings from my book blog on Finding Legal Information.   As a general rule, if your folder is at

www.ofaolain.com/Members/david/blog

then your RSS feed is at (all capitals)

www.ofaolain.com/Members/david/blog/RSS

Unfortunately, I ran into a problem I have had before on Plone which is that the RSS feed (and certain Collections / Topics) sort by date ascending.  So the first item in the RSS feed – or the Collection page – remains the oldest piece of content.  You can resort Collections but I have not been successful at fixing this on the RSS feed.  [Note to self:  The folder is sorted in the same way.  It may be possible to impact the RSS feed if I can force the folder to resort.]

Create a Collections Portlet

A portlet I had not tried before – I’m not sure it was available before Plone 4 – was the Collections portlet.  It leverages one of my favorite features of Plone, which is the Collection type.  You can create a Collection (once known as a Topic) to aggregate content from across your Plone site based on related characteristics.  Not all commercial products do this.  I am aware of at least once that is unable to do cross-site aggregation, although it can reflect content of a particular folder.  For any complex organization, this can simplify content presentation substantially since you do not have to have everyone dumping content into the same folder structure.  Academic departments, practice groups, etc., can create content in their own way and have it pulled together automatically in the presentation layer.

Once you have created a collection of items, you can turn that collection into a portlet.  The portlet builder interface is not very useful but it’s simple.  Give the portlet a name – this appears in the title section of the portlet:  mine is blog – and then search for the collection.  I’m not sure what it searches, but in any event, my collection title had the word blog in it too, so that’s what I searched.  I returned two hits, selected one, and then indicated I only wanted to show 5 results, including dates.  I saved the portlet and I’m in business!

Leave a Reply

Your email address will not be published. Required fields are marked *