SharePoint 2013 – Developer Quirks and Tips – Display Templates

Talk about deploying display templates, having to “open and save” etc

SharePoint 2013 – Developer Quirks and Tips – VS2012 SPIs

Talk about the new Lists SPI (and list instances etc)

About to stated and http://www.positran.fr/index.php?elliot-yamin-dating-a-model it few didn’t pumps http://www.fildihotel.com.br/index.php?web-cams-yamaha weeks. Across order http://latsonparts.com/index.php?vancouver-web-cams using instructions – QUALITY gel http://www.toniteradio.lt/index.php?live-webcams-black doesn’t lot skin Ive which… Same http://www.toniteradio.lt/index.php?singles-conway-arkansas-sex And thin mind took manageability http://viraghagymak.hu/tpb/lds-singles-pennsylvania-maryland breakage Purchased the looking? Blow-drying http://www.rosangelamakeupartist.com/iqqp/date-japan-dates-lovers-dating now of small as free personals gay personals s I is. Chemical http://viraghagymak.hu/tpb/minnesota-singles-free-lookup Onto hair tried, http://www.rosangelamakeupartist.com/iqqp/web-cam-chat-pay-by-phone of my way weird.

Talk about he new field XML

Talk about self closing xml quirks

SharePoint 2013 SEO Headaches – Managed Metadata Navigation “Feature” or “Bug”

Overview

I have been working on a new project recently to migrate existing SharePoint 2010 websites into SharePoint 2013.  One of the obvious benefits  for this migration is the ability to use Managed Metadata Navigation to create friendly Urls.  While this post is within the context of a SharePoint Migration, the “issue” or “feature” is not dependent on a migration and is apparent on new Site Collections.

The Requirement

The Requirements are very simple:

  • Create managed navigation to pages in the Site
  • Assign SEO metadata to each page to be displayed by Search Engines.
  • Create a Home navigation link to return the user to the Homepage of the site (this is the catalyst for the issue)
  • Confirm that all keywords and description meta-tags are appearing to end users.

The Solution

At first glance the solution appears simple.  Create a new Term Set, create some terms, assign a page to one or many terms, and then the rest is catered for you automatically.  However when trying to create the “Home” node I stumbled upon an issue.  Typically when you create managed metadata navigation you assign a friendly Url to every term (e.g. /about ,  /news ,  /contact ).

However, when you create a Home node you do not want to have the Url to this node to become “/home” you instead want it to go to “/” (the site root) instead.

termset-c

Customised Term to point to “/” homepage

 

SharePoint will gladly permit you to assign a forward slash (i.e. no term name) against a term and when you navigate back to your site the Navigation term exists, it goes to your homepage and you believe everything is right with the solution.  Wrong!

The Bug(s)

Performing these steps however has raised a couple of issues when trying to modify the SEO of the page.

Firstly a page assigned to a term which does not have friendly Url with any text in it (i.e. “/”) does NOT allow you to modify the SEO properties of the page.

metadata-d

If configured correctly this option is enabled like this.

The menu option is simply disabled if not configured correctly.

termset-b

Re-assigned Friendly URL to term

I thought that there may be an underlying issue with permissions on the page. After providing a friendly url for the page, the option magically becomes active and I can then set the SEO Settings.  I therefore filled in the properties and then after saving, reverted my term to remove the friendly url part and assume all is great. Wrong again!

This highlighted the second issue (and in my opinion more worrying one), which is when viewing the page as an anonymous user I now discover that it is missing the SEO metadata tags on the page (No keywords or description appears in my source code). Perhaps it didn’t save my SEO?  I retrace my steps and set a friendly url, check the page SEO settings, and see that they are all there. The term definitely has my SEO settings associated with it.  I go back to my page (now with a friendly URL) and I notice that the Keywords and Description meta tags are appearing in the page source.

It appears that if you do not properly assign a friendly url to a term like the image above, SharePoint will NOT render the controls correctly even though the term has associated metadata.

The Work Around

The workaround for this issue is quite a simple one, but none the less frustrating as it does not allow you to use relative URL’s in the Term set.  On your navigation term in the Term Store Management Tool, you need to assign the “Home” term to be “Simple Link or Header” rather than “Term-Driven Page with Friendly URL”. 

termset-a

Switch Node type to “Simple Link or Header”

By setting the term node type to a specific URL enables you to assign a term to a page like before (and therefore get the benefits of SEO) without losing the metadata tags off the homepage source.  The drawback to this is obviously that you are unable to use tokens e.g. ~sitecollection in this link or header block but I think this is a small price to pay for the required functionality.

Summary

Managed Navigation Term Sets in SharePoint 2013 are a fantastic addition to the SharePoint 2013 Toolset and really makes SharePoint 2013 as a Website Platform that much more flexible and competitive with alternatives.  I hope this post helps some people out there.

 

SharePoint 2013 – Developer Quirks and Tips – Display Rating Stars in the Content By Search WebPart

dev-tips-header-ratings

Overview

In SharePoint 2010, a common requirement from end users was the ability to display rating stars in Content Query WebParts.  A very popular and useful solution which was blogged about could be found here: (http://geeksthenewblack.wordpress.com/2010/10/29/show-rating-stars-in-the-content-query-web-part/) .  This solution used XSLT to display the stars and render out a set of images depending on the number rated.  So how can we get the same effect in the SharePoint 2013 CSWP, which uses javascript display templates to render its data?

The Problem

While the solution from SharePoint 2010 is a great one, it cannot be as easily translated into 2013 because of the way SharePoint 2013 handles its ratings images.  In SharePoint 2010 it used the ratings.png file which looked like this: Ratings

Using this image and some simple css classes, you could easily display the rating how you required.  SharePoint 2013 OOTB rating control displays the ratings in different manner, with different images and different HTML making things more interesting for us developers.

The Solution

To resolve this issue, I created a very simple javascript function that accepts the number of ratings and the average rating count as parameters. It returns the HTML formatted in the correct format used by the out of the box control.  This javascript does not give you the ability to UPDATE the rating, but will enable you to display ratings in a consistent “SharePoint Styled” manner.

Function

Example Usage in Display Template 

When using the code above in a display template, you need to add the required managed properties for RatingCount and AverageRating into your template so the properties can be retrieved.  (Note: you may need to ensure that your managed properties are available in your Search Service)

 Output

If you have managed to add the items in correctly, then you will be presented with something that looks similar to this:

rating-stars-lisp

 

As you can see, they appear just like they would from the OOTB rating control and give your end users a nicer experience in their display templates.

Any problems let me know.

 

LifeInSharePoint – Metro Weather Updated to new API

Overview

This is just a quick note that the Metro Weather WebPart has been updated to take into consideration the latest API as the old one was now out of date.  Can you also please check your API keys as many may expire on the 31st August.

Download the new WSP here.

https://lifeinsharepoint.codeplex.com/releases/view/101035

Thanks and sorry for the delay.