Expose the Web Part Title in the XSL of your CQWP

The last couple of days, I have been busy with customizing the OOTB Content by Query Web Part and Summary Links Web Part from SharePoint 2010. I wanted to get rid of the default look and chrome and present my data in a nice box with rounded corners and a title with matches the rest of my styles.
After 2 days of trying, I can say… the result is too my liking. 🙂

The first box is a Summary Links Web Part and the box below it, is a Content by Query Web Part.
To get rid of the default chrome, I simply set it to None in the Web Part properties.

 
Read more

Limit available web templates in your custom site definition

SharePoint 2010 allows you to create custom web templates or site definitions.
Using the UI, you can limit the available web templates which users are allowed to use if they want to create a new site.

The problem with this is that this is a manual action, to be done after creating a new site. It would be a lot better if the available web templates are always limited without having to do this every time you create a new site.
This is possible and can be done by using a custom site definition or web template where you can specify which templates are allowed. You can specify this in your custom onet.xml.
In this file, you have a Publishing feature with ID {22A9EF51-737B-4FF2-9346-694633FE4416} where you can add a property with the key “AvailableWebTemplates”.AvailableWebTemplatesThe value for this property is a list of web templates.
The format of this list has the following syntax:

“*-{FeatureID}#WebTemplateName1;*-{FeatureID}#WebTemplateName2;”

The FeatureID is the GUID of the feature which contains the definitions for the web templates.
The WebTemplateName can be found in the elements.xml of the web template.

ex.

AvailablePageLayouts property value has to be one a single line

Today, I was deploying a custom web template in SharePoint 2010 in which I had specified that only 9 custom page layouts were allowed. I did this by adding a property to the Publishing feature (id 22A9EF51-737B-4ff2-9346-694633FE4416) in my custom onet.xml file called AvailablePageLayouts where you specify the location and the name of the allowed page layouts.
The format of the string with the list of layouts you specify as the value for that property has to be specific:

  • the location of the page layout has to be a relative URL
  • they have to separated by a colon (:)

After I deployed the feature I created a new site from my custom template and all of a sudden I got an error:

All Page layout urls inside the string have to be server relative

The error message furthermore mentioned more information on which page layouts were affected.

When I looked at the list of page layouts I added to this property, they all had relative urls.
Since the 1st layout was not mentioned in the error, something started to go wrong with the second one. I placed each page layout on a new line because that was so much easier than a single line and this was the problem. So, I put everything on a single line and for sure… this solved the error. My site was created successfully and only the 9 specified page layouts were available.

Update (4/12/2011): Someone commented on this post that you can actually split the page layouts over multiple lines for readability. You just need to start each new line with the colon. And he’s right. The next does work: