Recreating tile view using Display Templates

May 14, 2014 — 13 Comments

A new feature of 2013 are the metro-style tiles. Every new team site has them as a banner on the homepage.

image

To create your own tiles you are limited to the promoted links app or the Announcement Tiles feature. I wanted the ability to use the tiles in my search results and other areas as needed. I have two display templates that will allow you to do just that, with any type of content within SharePoint. The solution consists of 3 parts:

  • Display Template
  • JavaScript file (Used for moving panel on mouse-over events)
  • CSS file for rendering the tile correctly.

 

Let’s get started…..

First we need to get our code and place them in their respective areas. Attached you will find the 3 files needed for this display template:

    • Item_HorizontalTiles.html
    • Item_VeritcalTiles.html
    • Tiles.css
    • Tiles.js

The item templates (Veritcal/Horizontal) need to be placed in your site collection display templates folder. The path is _Catalogs/masterpage/Display Templates/Content Web Parts/. The easiest way to do this, if you are not familiar with display templates is using the Designer manager via the site gear. When you drop these files SharePoint will automatically create a linked <name>.js file. This file contains all the JavaScript that is outlined in the display template.

Next, we need to place our CSS and JS files. I have placed mine in the /Style Library/CSS and /Style Library/JS respectively. You don’t have to place the files in this location. However, if you choose to put them somewhere else you will need to update the $includeScript and $includeCSS path in the display template HTML file.

 

Information about the template

The template renders a tile similar to one you use with promoted links and announcements tiles. It allows to you to map the following fields:

    • LinkURL (Auto Do Not Change)
    • PictureURL (Automatically pulls the most common managed properties for images)
    • Title (Title of the tile – First Line)
    • Description (Description of the tile – Second line onmouseover)

These fields can be mapped using the Content By Search web part when the display template is selected (See below)

image

As you can see I am setting this first search to return people:

image image

 

We could also change our query to return documents:

image        image

 

We could show announcements:

image image

Note: If you just added the ‘Rollup Image’ column to your announcements, the tile would show your image on the tile as well.

 

We can show article pages:

image image

You also choose to arrange these vertically using the Item_VerticalTile display template called “Vertical Tile” in the web part property selector.

image

 

As you can see, with the tile we can view any type of content we want. The HTML display template is easy enough to tailor this to any specific need or specific content that you would like. It is not necessarily a one-size-fits-all but it is a good start.

Source Files: https://github.com/kameronberget/SharePointPhiles

{Kam}

13 responses to Recreating tile view using Display Templates

  1. 

    Hi Phile! I tried it and it worked like a charm! I used this to display only a list of announcements as tiles! What if I want to change the background image of the tiles though? How do I do that? Thanks a lot

    Like

    • 

      The easiest way is to add the Rollup Image site column to your announcements list and reference the image there. The default property mapping of the display template looks for this column and will display it as a background image. Sorry for the late response.

      Like

  2. 

    I don’t understand how and where to save this info

    Like

    • 

      You need to save the HTML files into the _Catalogs/masterpage/Display Templates/Content Web Parts/ folder of the site collection. You can store the JS and CSS files wherever you would like. You just need to be sure to include that path within your display templates.

      Let’s get started…..

      First we need to get our code and place them in their respective areas. Attached you will find the 3 files needed for this display template:

      Item_HorizontalTiles.html
      Item_VeritcalTiles.html
      Tiles.css
      Tiles.js
      The item templates (Veritcal/Horizontal) need to be placed in your site collection display templates folder. The path is _Catalogs/masterpage/Display Templates/Content Web Parts/. The easiest way to do this, if you are not familiar with display templates is using the Designer manager via the site gear. When you drop these files SharePoint will automatically create a linked .js file. This file contains all the JavaScript that is outlined in the display template.

      Next, we need to place our CSS and JS files. I have placed mine in the /Style Library/CSS and /Style Library/JS respectively. You don’t have to place the files in this location. However, if you choose to put them somewhere else you will need to update the $includeScript and $includeCSS path in the display template HTML file.

      Liked by 1 person

  3. 

    Hi Phile,

    First thanks for this awesome display template it works perfectly.

    I do have a question regarding some branding modifications. Sometimes I receive the question to make the tiles smaller. When I modify the CSS it seems that the Title and TitleDescription are not moved to the top or resized so it will not show up. When I found the class and tried to add a padding-bottom or something like that it not works.

    I thought simply to replace all 200px for 80px and adjust the font but it’s a no-go for me. Can you please tell me what I need to modify to resize the tiles?

    Thanks in advanced I appreciate the help,

    Kind Regards / Mit freundlichen Grüßen,
    Maarten BOONEN | pressto@hotmail.com

    Like

  4. 

    Is there a way to make the tiles smaller and still have the functionality that this provides? I know there are ways to do this with the promoted links but when I try with this solution it is not working I could really use the help fixing this issue

    Like

  5. 

    Is it possible to make sharepoint list view as tile view using Javascript and Jquery?

    Like

Trackbacks and Pingbacks:

  1. Announcement Tiles « SharePoint Phile - July 3, 2014

    […] Represent any data in SharePoint as a tile? […]

    Like

  2. Searchbasierte Kacheldarstellung | Nils Hetterscheidt - March 10, 2015

    […] to Phile for his excellent Blog article and his code that I used as a […]

    Like

  3. Organizing and Managing Promoted Links (Tiles) | @WonderLaura - July 26, 2016

    […] lists, this seems to be the only way.  Alternately, if you’d like to use a more efficient way, this blog post by Kameron Berget shows a great way to use the content search web part, and have the results show appearing as a list […]

    Like

  4. Recreating tile view using Display Templates « SharePoint Phile | Soyka's Blog - December 1, 2016

    […] Source: Recreating tile view using Display Templates « SharePoint Phile […]

    Like

Leave a comment