Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Ok I created my first master page and now I am working on page layout. I created a new "Publishing Content Type" page layout in SharePoint Designer whose content type was "Page". In that page I want to display an image slider. As I understand I need to make a web part of image slider and then insert into this layout.

My questions is how do I do that? No I am not talking about how to make a web part or image slider but what code do I write in page layout to add it? Do I need to add a web part zone in it (this is what I have heard) or a WebPartAdder?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

In a SharePoint Designer situation, insert actual Web Part in the targeted Web Part zone after exporting it from any page.

This works best only if you plan to use it on a single Site Collection, as repeated deployments must be manually performed elsewhere. In such situations an automated deployment is recommended, and in such cases the best way to have a web part automatically provisioned for you is to use the AllUsersWebPart (in this case RootWebOnly ensures that your Page Layout is only deployed on the Top-Level site as it should be!).

One additional tip: Repeated deployments (via features) of the Page Layout - if already in use - must be performed by temporarily changing the Page Layout, updating it, and re-applying to all Pages (make sure the Content Type has the same structure across Page layouts to avoid using data)!

The example below could be used in an automated deployment via Features with a Module.

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module Name="PageLayouts" RootWebOnly="True">
    <File Path="PageLayout\Home.aspx" Url="Home.aspx" IgnoreIfAlreadyExists="true">
      <AllUsersWebPart WebPartZoneID="Left" WebPartOrder="1">
        <![CDATA[ ]]>

See also example detailed here http://blogs.msdn.com/b/uksharepoint/archive/2011/04/04/provisioning-web-parts-to-a-page.aspx

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.