If you would like to discuss anything, please contact me via email: Howard.Bayliss@sequence.co.uk

Saturday, January 29, 2011

Search - Click Through Relevancy

You may have heard that SharePoint 2010 search (not Foundation) includes "Click Through Relevancy". This means that, as more users click on a specific link in the search results, SharePoint will increase the link's ranking.

It made me wonder if Google use the same approach as part of their page ranking algorithm?

If it did, you could perhaps post links to a site with a special query string, making use of the Google "I'm feeling lucky" to simulate a click e.g.


Of course that would be too easy to abuse, which is why Google don't do it.

However, our in-house SEO experts told me that Google Instant search did allow something similar and was exploited.

Friday, January 28, 2011

SharePoint Relative Url

We have a number of page layouts which allow the user to enter a URL. SharePoint stores the value as an absolute value, along with a description.

(BTW, you can use the SPFieldUrlValue class to extract the URL and description).

Anyhow, I wanted to generate a relative path from stored absolute value. I used the following code to do it.

Maybe you know a better way.....?

SPFieldUrlValue spFieldUrlValue = new SPFieldUrlValue(fieldValue);

string targetUrl = spFieldUrlValue.Url;

using(SPSite site = new SPSite(targetUrl))
  return targetUrl.Replace(site.Url, String.Empty);

Tuesday, January 25, 2011

2 Level Navigation

I wanted to create a mini-sitemap which had the following criteria:
  1. Only show sites
  2. Only show 2 levels of navigation

This article gave me an insight and I was then able to come up with this as the solution:

<SharePoint:AspMenu ID="FooterGlobalNav" runat="server" DataSourceID="GlobalNavDataSourceFooter"
Orientation="Vertical" StaticDisplayLevels="2" MaximumDynamicDisplayLevels="0" UseSimpleRendering="true" />

<publishingnavigation:portalsitemapdatasource id="GlobalNavDataSourceFooter" runat="server"
sitemapprovider="CombinedNavSiteMapProvider" showstartingnode="false" startfromcurrentnode="false"
startingnodeoffset="0" trimnoncurrenttypes="Heading" treatstartingnodeascurrent="true" />

Friday, January 21, 2011

The resource cannot be found - CONTROLTEMPLATES

While working in our team environment, a colleague stated that the SharePoint site had gone done. A screen shot is shown below:

The error only occurred on the root site.

It turns out this was because the home page of the root site (default.aspx) uses a page layout which references some custom user controls in the CONTROLTEMPLATES folder and my colleague's VM did not have these.

Sunday, January 16, 2011

Hello World

This is my first post on my first ever Blog. I've just started a large SharePoint 2010 project and wanted to share my experience and pass on some of the things I learn along the way. Hopefully that will be useful to someone out there.