For those of you who post regularly, Technorati is a great way to categorize your posts on the Technorati site, it is also a great way for other blog search engines to figure out what your posts are about. Its also good for you to see what other content is generated the category that you're writing about. I personally forget to create the Technorati Tags in my blog posts, so I wanted a way to create the tags automatically with SharePoint. One thing that I've done differently with my blogs is enabled the Category lookup for selecting multiple items from the Category list. You don't need to do this for this script to work, but this modification was designed for tagging multiple categories with ease.
This is the first step is to enable multiple categories on your blog post list. Navigate to the list settings for the Posts list.
Make sure you select the "Allow Multiple Values" field underneath the Title selection.
Next we're going to want to open up the Post.aspx file in SharePoint Designer.
Navigate to "Data View" -> "Insert Data View "on the Toolbar. Click on the Posts List, and go to "Show Data"
From the Current Data Source View, select only the Category Field, and select the button that says "Insert Selected Field as" and select "Single item View"
Now we need to turn of Paging for the view:
Sometimes it automatically creates the PostID Paramter for you, but if it doesn't show up in the Parameters dialog, you will need to create a new parameter that is called ListID. Select New Paramter and choose "Query String" from the Parameter Source. The Query String Variable should be "ID" and you can put whatever default you like. I put the ID of the first blog post that I have.
Next you need to filter by that PostID which you just created. The Field name should be ID, with the "Equals" comparison and the value you should find at the bottom of the Value list which is "[PostID]". Hit OK to filter the view.
.
Now here comes the fun part, we need to modify the XSLT to strip some of the formatting that SharePoint uses for multiple categories and enable multiple tags for multiple categories. Luckily I've done all the hard work already, so you should just need to copy this script into your Code View. Find the <xsl:template name="dvt_1.body"> and the <xsl:template name="dvt_1.rowview">
tags in your body. Select both templates them and replace them with the following code in your source code view.
<xsl:template name="splitstr">
<xsl:param name="str" select="."/>
<xsl:choose>
<xsl:when test="contains($str,';')">
<xsl:text disable-output-escaping="yes"><a href="http://technorati.com/tag/</xsl:text>
<xsl:call-template name="technorize">
<xsl:with-param name="tag" select="substring-before($str,';')"></xsl:with-param>
</xsl:call-template>
<xsl:text disable-output-escaping="yes">" rel="tag"></xsl:text>
<xsl:value-of select="substring-before($str,';')"></xsl:value-of>
<xsl:text disable-output-escaping="yes"></a></xsl:text>
<xsl:text> | </xsl:text>
<xsl:call-template name="splitstr">
<xsl:with-param name="str" select="substring-after($str,';')"></xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:text disable-output-escaping="yes"><a href="http://technorati.com/tag/</xsl:text>
<xsl:call-template name="technorize">
<xsl:with-param name="tag" select="$str"></xsl:with-param>
</xsl:call-template>
<xsl:text disable-output-escaping="yes">" rel="tag"></xsl:text>
<xsl:value-of select="$str"></xsl:value-of>
<xsl:text disable-output-escaping="yes"></a></xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="technorize">
<xsl:param name="tag"></xsl:param>
<xsl:choose>
<xsl:when test="contains($tag,' ')">
<xsl:value-of select="substring-before($tag,' ')"></xsl:value-of>
<xsl:text>+</xsl:text>
<xsl:call-template name="technorize">
<xsl:with-param name="tag" select="substring-after($tag,' ')"></xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$tag"></xsl:value-of>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="dvt_1.body">
<xsl:param name="Rows"/>
<xsl:param name="FirstRow" />
<xsl:param name="LastRow" />
<xsl:for-each select="$Rows">
<xsl:variable name="dvt_KeepItemsTogether" select="false()" />
<xsl:variable name="dvt_HideGroupDetail" select="false()" />
<xsl:if test="(position() >= $FirstRow and position() <= $LastRow) or $dvt_KeepItemsTogether">
<xsl:if test="not($dvt_HideGroupDetail)" ddwrt:cf_ignore="1">
<xsl:call-template name="dvt_1.rowview" />
</xsl:if>
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template name="dvt_1.rowview">
<tr>
<td>
<table border="0" cellspacing="0" width="100%">
<tr>
<td width="25%" class="ms-vb">Technorati Tags</td>
<td width="75%" class="ms-vb">
<xsl:call-template name="splitstr">
<xsl:with-param name="str" select="@PostCategory"></xsl:with-param>
</xsl:call-template>
</td>
</tr>
</table>
</td>
</tr>
</xsl:template>
You should end up with the following output:
