I'm working on a sharepoint publishing site that has custom page layouts. I'd like to add a web part zone to one of the custom layouts that present a default web part that the user can then remove or change the properties of when they create a page.
I'm trying this:
<WebPartPages:WebPartZone id="zone1" runat="server" title="Zone 1">
<ZoneTemplate>
<Something:LookingForLinks runat="server" id="wp_lookingForLinks"/>
</ZoneTemplate>
</WebPartPages:WebPartZone>
The web part zone is available for adding webparts, but my default web part is not present after a page is created. Am I missing something here?
Best Answer
You could also deploy your page layouts as an individual feature rather than creating a whole site definition. That way you could deploy your page layouts to any SharePoint publishing site. If you are using VS 2010, start with a SharePoint Module project. Add your layout aspx file to the project. Modify the elements.xml file to resemble this:
This deploys your layout and makes it available as for new publishing pages. Now, to get a webpart to be instantiated in new pages, you modify the
<File>
element with the webpart definition. For example, I could define a content editor webpart to be created on new pages in Zone1 like this:This should be more practical than creating a whole new site definition. Hope this helps.