1

I want my site to have a side column which will contain some default content (banners, rss feeds, summary link lists etc.) and I would like to have all this included by default in any pages created but allow creators to modify or replace it with any other content or web parts if they want to.

I've added this default content as a series of web parts in a web part zone in the layout file, and any newly created pages using this layout do indeed get a copy of this content which can be customised, but any changes I subsequently make to the web parts in the layout file are not reflected in any already created pages.

What's the best way of setting things up so that I can make changes at a high level which will be automatically reflected in child pages which include a non-customised copy of it?

2 Answers 2

1

You could use Reusable Content in your content editor.

Also remember to add the content in <div class="noindex"> .. </div> tags, so the content doesnt pollute the index.

3
  • Interesting but I don't see how these can be used for this requirement because there's no way of making some reusable content appear by default on newly created pages. Or is there?
    – stovroz
    Commented Feb 21, 2011 at 17:22
  • well you could add a content editor web part, just like you could insert it manually. A think to look out for here is that if you re-provision your code, it will be added twice. I got some code that handles this in a feature receiver, i cant reach it from my current location but ping me if you need it Commented Feb 21, 2011 at 20:31
  • above should have been "you could add a content editor web part programmatically" Commented Feb 21, 2011 at 20:31
0

You shouldn't include the webpart in the layout file, since it will basically just become a control then. Any changes to the webpart in the UI will not be saved since the webpart is part of the page. Any changes you would have to do the in the pagelayout's aspx itself.

To include a webpart in a pagelayout when a new page is created based on that layout, you use the AllUsersWebPart xml element in the feature you deploy the pagelayout in.

More info here and here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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