Hi, I'm Ricky. You Found Me!

Well, after several years of putting it off, I finally have a blog up and running. My plan is to concentrate on the wonderful language that is C# (and other .NET stuff from time to time) and the last CMS you will ever need, Umbraco.

If you are a .NET developer and you have never heard of Umbraco, you really should check it out. In fact, this entire site is built on Umbraco and a modified version of the Blog for Umbraco 4 package by Tim Geyssens.

If you are familiar with Umbraco and need to get a blog up and running, I highly recommend starting with Blog for Umbraco 4. It will save you a lot of time and energy. You can find it in the Umbraco Package Repository.

I made some pretty major modifications to the Document Types, Master Pages, CSS, JS and XSLT. I also created a new comment form that better suited my needs. However, this was all extremely easy thanks to the flexibility of Umbraco and Tim's rather open architecture. Tim, if you ever read this, thanks a million for sharing!

One modification I made that I would like to pass along is in the XSLT for listing blog comments. Even though the current XSLT in the package specifies a height and width for the gravatars, these parameters are being ignored by the gravatar API because the XSLT is generating double ampersands between them.

As you can see below, I wrote what I consider to be a pretty ugly workaround.

<xsl:text disable-output-escaping="yes">
  <![CDATA[<img class="gravatar" src="]]>
</xsl:text>
<xsl:value-of select="BlogLibrary:getGravatar(data [@alias = 'email'], 30, '{your default image}')" disable-output-escaping="yes"/>
<xsl:text disable-output-escaping="yes">
  <![CDATA[" alt="Gravatar of ]]></xsl:text>
<xsl:value-of select="data [@alias = 'name']" disable-output-escaping="yes"/>
<xsl:text disable-output-escaping="yes">
  <![CDATA[" />]]>
</xsl:text>

CDATA everywhere!

If anyone has a better solution, I am all ears!

UPDATE! Please see the solution to this problem from Benjamin Howarth in the comments.

Comments

  1. Gravatar of Benjamin Howarth By Benjamin Howarth on Tuesday, December 21, 20101
     
    <img class="gravatar" src="{BlogLibrary:getGravatar(data [@alias = 'email'], 30, 'your-default-image.png')}" />Gravatar of <xsl:value-of select="data [@alias = 'name']" disable-output-escaping="yes"/>

    Not an inch of CDATA in sight :-)
  2. Gravatar of Ricky Beard By Ricky Beard on Tuesday, December 21, 20102
     
    Thanks Benjamin! Your solution works perfectly. I made a couple of changes to fit my design and wound up with:

    <img class="gravatar" src="{BlogLibrary:getGravatar(email, 30, '{your default image}')}" alt="Gravatar of {name}" title="{name}" />

    Works great!
 

About Me

I am a Founder and Managing Partner of Trio Technologies and Trio Merchant Services in Abilene, Texas. I have a beautiful wife and two incredible sons.

Popular

Blogroll

Bookmarks