Thursday, November 8, 2012

Sharepoint 2013 Communities - Create an "Associated Communities" fonction

We are actually building a Social network based on Sharepoint 2013 for a Huge Airways company.

One need was to be able to associate communities together in order to ease the navigation between communities.

To do so, we have used the super powerfull search engine!!

Step 1 : Create a new Display template
  • on your Site collection go to the masterpage catalog (_catalogs/masterpage/Display Templates/Search) and copy the Item_Community.html file.
  • Modify it (For our needs I wanted to display the sitelogo, and change some display). QUite easy to do. It's only manipulating JS and HTML.
  • Post your newly renamed HTML in the same folder and it will automatically create the associated js.
Step 2 : Set a parameter in the propertybag of your site
  • I have added a new property "AssociatedCommunities" on the community using a simple aspx page. The code is simply :
    • Web.AllProperties["AssociatedCommunities"] = "URLCOmmunity1;URLCOmmunity2;URLCommunity3;"
Step 3 : Create a new managed metadata based on your property 
  • Do a full crawl on your content source to make your property available for your search service.
  • In the search service, create a new managed metadata that you will Set as Searchable and Queriable, and then map it on your propertybag property.
Step 4 : Add a search result webpart on your community page
  • Set the following query :
    • WebTemplate:Community AssociatedCommunities:{SiteCollection.URL}
  • In the "Display template" section put "Use a single template to display items" and set your display template
  • I personnaly removed all the options (but the "ranked results" one).
Step 5 : Pray for the search of having done correctly its work!! :)

No comments:

Post a Comment