Web Templates and Publishing Sites

[转]http://www.chakkaradeep.com/post/Web-Templates-and-Publishing-Sites.aspx

Web Template is one of the excellent features added to SharePoint 2010. In a very easy layman terms, Web Template helps developers to provision sites without the need of creating a site definition, but use any of the existing (out of the box) site definitions. This has its own pros and cons and if you are very eager to know what web templates are and how to use them, head over to - http://blogs.msdn.com/b/vesku/archive/2010/10/14/sharepoint-2010-and-web-templates.aspx – Vesa (from Microsoft) explains it very thoroughly about it.

One other added advantage of building web templates is that they can be used in a sandboxed environment – which opens the door to SharePoint Online – which also means, you can now build a custom publishing web template and upload it to SharePoint Online!

Clearing the confusions for Publishing Site web templates

If you look at the MSDN documentation of creating custom web templates, it is not useful if you are looking in building a custom publishing site web template. The documentation does not tell if it is possible to create a custom publishing site web template as it recommends to create a web template by saving a Web site "as template" in the UI, which is not available for publishing sites.

I highly recommend following Vesa’s blog post to do so. In fact, don’t even consider the steps outlined in MSDN for creating any custom web template (until at least they update it!) – Vesa’s blog post approach is much nicer, cleaner and highly customizable.

Requirements for Publishing Site web templates

There isn’t any requirements, except that you need to have all the required publishing features activated in the site collection. So, if you are deploying your publishing web template to a Team Site, make sure the site collection has the publishing features activated, otherwise site creation will fail and you will see an error something like this:

Where is my custom Web Template?

When you deploy a custom web template to a publishing site, the web templates gets deployed but it is not available until you select it as one of the preferred templates for the subsite.

To do so, after deploying your custom web template solution, go to Site Actions -> Site Settings | Look and Feel –> Page layouts and site templates

Select your custom web template and add it to the preferred site templates:

Once selected, it will be available in the New Site creation dialog:

你可能感兴趣的:(template)