Skip to main content

Blojsom: Configuring a Community Blog with the Internal Aggregator Plugin

I have been having hard time modifying Blojsom's templates to get the Internal Aggregator plug-in to work. I wish there were a concrete example or a tutorial for me to follow. Today I googled again after a desperate fight with Blojsom and fortunately came across Todd Slater's posting.

Mr. Slater posted his working copy of the template files. I downloaded, put it in to the template folder right away. And...it works!

I'll be studying how he wrote the template very soon. But in the mean time, thank you very much Mr. Slater!

Keywords: , , ,


Update: Jan 5, 07

Here's the difference between my asual-entry.vm and Mr. Slater's:

Mine looks like this:

#macro(multiBlogFriendlyPermalink $entry) macro definition at the top of the file.
#macro(multiBlogFriendlyPermalink $entry)
  #set ($categoryForEntry =
    $entry.getBlogCategory().getCategory())
  #if ($categoryForEntry == "/")
    #set($categoryForEntry = "")
  #end
  #set ($entryLink =
    $entry.getMetaData().get(
      "BLOJSOM_PLUGIN_INTERNAL_AGGREGATOR_BLOG_URL")
    $categoryForEntry$entry.getDateAsFormat("yyyy")/
    $entry.getDateAsFormat("MM")/
    $entry.getDateAsFormat("dd")/
    $entry.getPermalink()")
#end

Then
#multiBlogFriendlyPermalink($entry)
#set($permalink = $entryLink)
...
<a href="$entryLink">
...


Mr. Slater chose not to use the macro and his code looks like this:
<a href="$entry.getMetaData().get(
    "BLOJSOM_PLUGIN_INTERNAL_AGGREGATOR_BLOG_URL")
$categoryForEntry$entry.getDateAsFormat("yyyy")/
$entry.getDateAsFormat("MM")/$entry.getDateAsFormat("dd")/
$entry.getPermalink()")">

Mine doesn't work but Mr. Slater's works. So I guess there must be something wrong with this rather complicated use of macro. Perhaps, it is the limitation of Velocity which is the template engine used by Blojsom. It is most likely that the #set assignment breaks when it has a very long right-hand-side argument. I removed calls to the multiBlogFriendlyPermalink macro and now use Mr. Slater's style. It works!


Update: Jan 6, 07

I looked at Mr. Slater's code and saw references to the $categoryForEntry variable. I can't find any #set($categoryForEntry = ...) assignment in his code, which oppose mine being defined in the #macro(multiBlogFriendlyPermalink $entry) macro definition. Therefore, $categoryForEntry must be a predefined variable, I think.

I finally found its definition in Blojsom source folders. $categoryForEntry is defined in plugins/src/org/blojsom/plugin/admin/templates/
admin-macros.vm
and plugins/src/org/blojsom/plugin/
velocity/page-macros.vm
. It is deployed at the same paths inside WEB-INF/lib/blojsom-plugins-templates-2.32.jar.

Comments

Popular posts from this blog

Padonc's "Bought from Mae Hong Son" T-shirts -- Interesting Souvenir from Mae Hong Son

Padonc's "Bought from Mae Hong Son" T-shirts -- Interesting Souvenir from Mae Hong Son The "I love New York" t-shirt and the series of souvenir was one of my impressive memory from my previous trips to New York City. I got this same kind of impression when I was browsing by the shops by the Jong Kam Walking Street in the city of Mae Hong Son in the second night of the trip. I didn't look at the seller when I caught the sight of these T-shirts. The seller greeted me and, surprisingly, she was P'Kwan, my senior alumni from Chulalongkorn University, who lives in Mae Hong Son and gave me a warm welcome when my family and I went for a dinner at Fern Restaurant in Mae Hong Son town the other night. Note: Pi or P' (its abbreviation) is a Thai word to call an elder sister or brother. Here are the pictures: P'Kwan and Her Shop The T-shirts P'Kwan and the Shop P'Kay, P'Kwan's Husband, at Another Shop Keywords: trips , mae-hong-son , thai

Tip: Converting a CSV File into XML by Excel

I came across a problem to convert a historical data in comma-separated format (CSV) into a modern & more useful XML format. There are many ways to do such conversion. The most obvious one is to do it programmatically by writing a program to read CSV data and exporting it to an XML file by means of the Simple API for XML (SAX) or the Document Object Model (DOM) libraries. But I was too lazy to do it. I knew that Microsoft Excel 2003 supports exporting worksheets into XML data. I tried it out but found that it is not that simple -- we have to define an XML schema and bind each element to each column of the worksheet. So I went on researching. Finally, I found a very useful tool on MSDN: Excel 2003 XML Tools Add-in Version 1.1 ( download ). The Excel Add-in's "XML Tools -> Convert a Range to an XML List" menu command allows us to simply select a range in a worksheet (with or without first row as column names) -- with the advanced options to specify the XML root

It’s been eight years and here comes COVID-19 in early 2020

This blog was last posted in 2008 before Facebook and LinkedIn went mainstream. I have since then socialized and posted a lot on Facebook and LinkedIn. During the global COVID-19 crisis in early 2020 people dramatically change the way they live and work since they day I last posted on this blog. They stay a lot at home during the great lockdown to prevent the spreading of the coronavirus. Here is a summary of my online presence: Facebook: http://fb.com/drthitiv LinkedIn: http://linkedin.com/in/thitiv LINE: http://line.thiti.it Bangkok, THAILAND April 22, 2020