Press ESC to close

How to reference your custom CSS within a Search Display Template

Display Templates are incredible powerful within SharePoint 2013. You can create a new one based on an existing display template. To change the look & feel you create your own CSS. To reference to this CSS file you have to add the following code under the <body> tag:

    <script>

        $includeCSS(this.url, “~sitecollection/Style Library/YourCSS.css”);

    </script>

 In some cases a script tag already exists referencing a JavaScript file, just add the CSS reference within this tag, no need to create a new one.

Hope this helps you save some time and create awesome display templates 🙂

Jasper Oosterveld

My name is Jasper Oosterveld. I am a Microsoft MVP, Data Security & Microsoft 365 Consultant based in the Netherlands. I’ve spent the last decade helping organizations tackle complex challenges around Governance, Adoption and Data Security with Microsoft Purview. My mission? To empower companies to protect their data and streamline collaboration in Microsoft 365, all while keeping governance and adoption at the forefront.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.