Roller Weblogger improved blogroll display code for use with icons and images

Here’s some code that improves on the default Roller Weblogger blogroll code to ensure that if you include an image / icon for your blogroll entries it displays the image and the blogroll entry name (good if your using icons).

Using the default roller macro for displaying your blogroll means that no text is displayed if an image / icon URL is given. The default behaviour leaves rather empty lists of course, so I see this as an improvement.

So this code is effectively a replacement for “#showBookmarkLinksList($rootFolder false false)”, although it still uses the same CSS notation for lists, so as not to disturb your design.

It works with specific blogroll folders, so you do need to dictate which one your going to display (in the example below it’s “/My Blog Roll”). However this could be improved further to pick up the current folder name if you were to cycle through the sub folders (but I didn’t need it to do that, so I haven’t).

#set($rootFolder = $model.weblog.getBookmarkFolder("/My Blog Roll"))
#if ($rootFolder.bookmarks.size() > 0)

<h2>My Blog Roll</h2>

    #foreach ($bookmark in $rootFolder.bookmarks)
  • $  $
  • #end