Simple Silverlight SEO with ASP.Net and XSLT

A common practice with Rich Interactive Applications (RIAs) is to expose the text as hidden DIV section in on the same page as the Silverlight control.  I have crafted a page with a Silverlight application that has a unique word on it that is picked up by Google's search engine.  When search crawlers see the page, they don't see the Silverlight XAML but they do see the XHTML that is generated by transforming the XAML into XHTML.  Using the ASP.Net <asp:Xml> element and specifying an XSL Transformation that does this translation:

<div id="SLHost">

    <asp:Xml ID="XHTML" runat="server" DocumentSource="seo.xaml" TransformSource="XAML2XHTML.xslt" EnableViewState="False"/>

    <script type="text/javascript">

        createSilverlight();

    </script>

</div>

Try using this technique for your Silverlight applications running ASP.Net.  Here is how the content is transformed:

  • <Canvas> elements are turned into <div> tags
  • <TextElement> elements are turned into <div> tags with the text inside
  • <Run> elements are turned into <span> tags
  • <Image> elements are turned into <img> tags
  • <MediElement> elements are turned into <a href> hyperlinks.

It doesn't produce pretty XHTML but search engines don't care about that.  take a look at the XSLT transform and see how simple it actually is.  Using this technique, when the XAML changes, the plain-text XHTML content changes as well.