SharePoint 2013 Display Templates

Download Report

Transcript SharePoint 2013 Display Templates

A little bit of Search Magic, goes a long ways.
 Quick Search Over View
 What are Display Templates
 When to use them
 How to create some
 No code
 Code
 Alternatives
 Intent based
 Dynamic improvement
 Ease of use
 Massive flexibility
 Visual Interest
 Multimedia/format
 Huge productivity increases/time savings
 Content is stored in lists and libraries. Site columns are used to store values, or in
other words information, about each item in a list or library.
 When lists and libraries are crawled, site columns and the site column values are
added to the search index.
 In the search index, site columns are “transformed” into managed properties. Site
column values are “transformed” into managed property values
 On a search page, a user enters a query in a Search Box Web Part. The query is sent
to the search index.
 Search results are sent from the search index to a search results page, and
displayed in a Search Results Web Part. The Search Results Web Part uses display
templates that specify which managed property values should be displayed.
 Result Source

Scopes
 When a user issues a query, the search system associates the query with a result source to provide search
results.
 Query Transforms
 Part of result sources
 Allows for transformation of incoming query so that its more specific (People, Local Video)
 Result Types - the reason display templates exist.
 A rule that causes distinct kinds of search results to be displayed in different ways
 A result type is a classification of a search result.
 Display templates are used to display result types
 Query Rules
 Allow admins to respond to the intent of the user
 If rule is met additional actions can be performed
 Promoted results
 Ranking
 Templates used in Web Parts that use search technology (referred to in this article as
Search Web Parts) to show the results of a query made to the search index
 Control which managed properties are shown in the search results
 Also how they appear in the Web Part
 Each display template is made of two files: an HTML version of the display template
that you can edit in your HTML editor, and a .js file that SharePoint uses
 Only Search Web Parts can use display templates. The Content Query Web Part is not
search-driven, and so does not use display templates
 Its all about that metadata
 Site columns and site column values are “transformed” into managed properties
 Managed properties become available for display templates
 Example: author, created date, custom managed metadata column
 Display Templates, display managed properties.
 SharePoint comes with a multitude of crawled managed properties
 If you create your own, you must do a full crawl before it gets added
 Content Web Parts – Content Search Web Parts (YES!)
 Filters – Refinement Panel, Search Filtering (SLICK)
 Language Files – Localization (Only if you speak another language)
 Search – Search Center component Web Parts (maybe, but not today)
 Server Style Sheets (Bravery Required)
 System (Madness is a pre req)
 Improve Visual Queue will improve search result
 If all important/relevant information is all over your farm
 If you want to make a search result actionable
 To add relevant data to Search Results in controlled
fashionable way
 Great for user adoption
 Open your mapped network drive to the Master Page Gallery.
 Open one of the four folders in the Display Templates folder
 The folder you choose depends on the type of display template you want to use.
For example, if your site uses cross-site publishing, copy a display template from
the Content Web Parts folder.
 Use an existing display template as a starting point for a new display template
 When you create a display template by copying the HTML file for an existing
display template in the Display Templates folder in the Master Page Gallery:
 A .js file that has the same name is created in the location where you copied the
HTML file.
 All markup required by SharePoint Server 2013 is added to the .js file so that the
display template displays correctly.
 The HTML file and the .js file are associated, so that any later edits to the HTML file
are synched to the .js file when the HTML file is saved.
 Edit the HTML File
 Create a result type
 Edit the HTML file in the editor
of your choice (Dreamweaver,
SublimeText, whatever)
 Upload or simply save in place
 A little tough to work with
because the script is set in
comments
 Moves processing from the
server to the client, so be
prudent
 Also called a visual best bet
 Pretty nifty for certain scenarios
 Easy to do
 Add item count to refiner
 Add custom display template to content search web part.