WCM tip #1: Define Crawler XSL File for your Display Template

WCM tip #1: Define Crawler XSL File for your Display Template

When building custom Display Templates for Content Search Web Part always build a corresponding XSL Style Sheet and link it to your Display Template.

By default Content Search Web Parts use JavaScript-based Display Templates to render content aggregations. Because Internet search engines have limited support for parsing JavaScript, Content Search Web Part has a fallback mechanism built in. Whenever it detects that the page has been requested by a search bot, it uses XSLT instead of JavaScript to render its contents on the server. If no XSL Style Sheet has been associated with the Display Template used by the particular instance of Content Search Web Part, it will use the standard XSL Style Sheet which renders the contents of a content aggregation as an HTML table. As you can imagine, this HTML is very likely to be different than what your custom Display Template is rendering. As a result you might lose some important information about your content that could improve the ranking of your pages in search results. It is therefore a good practice to always provide an XSL-based equivalent of your JavaScript Display Templates for when pages are rendered to search engines.

Author’s comment

This is the first article in the series of SharePoint 2013 Web Content Management tips. In the upcoming weeks I will publish more tips touching variety of SP2013 WCM-related topics so stay tuned!


comments powered by Disqus