Although I do MOSS 2007 / WCMS development since 2.5 years I was wondering on how to limit the AvailableWebTemplates and AvailablePageLayouts  using onet.xml. I have done it before but I forgot so I will use this post to list the possibilities I have found and to unload things from my brain… ;)

As usual here is the scenario: I have a website (also works for collaboration).

image

When I chose Create Site or Create Page I want to show a limited set of templates to the user.

image image

Limiting templates by user interface

As you know you can limit the choices for a site collection if you go to Page layouts and site templates:

image image

There you can chose to limit page layouts or site templates or both. 

Limiting AvailableWebTemplates and AvailablePageLayouts by onet.xml

Page layouts are provisioned by the Publishing layouts feature and ProvisionedFiles.xml:

image

You can see the page layouts and file names. Since modifying the out of the box files is not a good idea and also not supported by Microsoft you have to use a different approach. In the following examples I want to have

  • Site templates of the kind BLANKINTERNET and
  • Page layouts of kind article.

In order to limit this you can use the following values for the properties AvailableWebTemplates and AvailablePageLayouts:

<Feature ID="22A9EF51-737B-4ff2-9346-694633FE4416">
    <!-- Publishing -->
    <Properties xmlns="http://schemas.microsoft.com/sharepoint/">
        <Property Key="ChromeMasterUrl" Value="~SiteCollection/_catalogs/masterpage/
            BlueBand.master"/>
        <Property Key="WelcomePageUrl" Value="$Resources:cmscore,List_Pages_UrlName;/
            default.aspx"/>
        <Property Key="PagesListUrl" Value=""/>
        <Property Key="AvailableWebTemplates" Value="*-BLANKINTERNET#1;
            *-BLANKINTERNET#2"/>
        <Property Key="AvailablePageLayouts" Value="~SiteCollection/_catalogs/
            masterpage/ArticleLeft.aspx:~SiteCollection/_catalogs/masterpage/
            ArticleLinks.aspx:~SiteCollection/_catalogs/masterpage/ArticleRight.aspx"/>
        <Property Key="AlternateCssUrl" Value="" />
        <Property Key="SimplePublishing" Value="false" />
    </Properties>
</Feature>

After creating a new site collection I have the limited templates: 

image  image

The following value was not working for me:

<Property Key="AvailablePageLayouts" Value="Template1.aspx:Template2.aspx"/>

This value was not working for me too:

<Property Key="AvailablePageLayouts" Value="*-Template#1;*-Template#2"/>

Deployment

Ok at which time can I limit the available choices?

  • If you are using the user interface can limit the templates at any time.
  • If you change the onet.xml of an already deployed solution in the 12 hive with an iisreset you can’t change the available templates.
  • If you change the onet.xml in your solution, deploy it afterwards and create a new site collection you can limit the templates.
  • If you change the onet.xml in your solution and do an upgrade of the solution you can’t change the available templates.

That are the things I know so far… have a nice day. :)

Add comment





  Country flag
 

biuquote
Loading