Reporting dead links in Multiple content picker

The Umbraco multi content picker is a wonderful little control, but can sometimes become a bit of a maintenance nightmare. The example below gives you an idea of how to implement dead link notification within XSLT.

The other way to deal with this would be have an action handler checking document integrity each time a publish occured, but this is a nice quick fix if you have a relatively small amount of content.

<xsl:if test="count($currentPage/data[@alias = 'Links']/nodes/node) > 0">
  <ul class="courselinks">
    <xsl:for-each select="$currentPage/data[@alias = 'Links']/nodes/node">
      <xsl:variable name="child" select="umbraco.library:GetXmlNodeById(./text())" />
        <xsl:when test="$child/@id != ''">
            <a href="{umbraco.library:NiceUrl($child/@id)}">
              <xsl:value-of select="$child/data[@alias='Page Title']"/>
          <xsl:call-template name="reportDeadLink">
            <xsl:with-param name="linkId" select="./text()"/>
            <xsl:with-param name="pageId" select="$currentPage/@id"/>

<xsl:template name="reportDeadLink">
  <xsl:param name="linkId"/>
  <xsl:param name="pageId"/>

  <xsl:value-of select="
                'Broken Link', 
                concat('Broken link to node ', $linkId, ' in ', umbraco.library:NiceUrl($pageId)), 

I store my email addresses as Umbraco dictionary items, but you could always hard code them in your XSLT.

Leave a comment