CS2: Duplicated Content throughout your site with Content Parts
This topic was also mentioned in Community Server Daily News a couple of days ago. I wrote this last weekend and scheduled it to publish today. But I decided to keep it anyway, since it gives some more details than what it did in the Daily News article. :-)
I had a conversation with Eric A. Duncan (Telligent) the other day. He helped shed some light on Community Server's Content Parts.
If you're an admin of a CS site you have seen them for example on the home page. The areas where you can double click to edit. It's a really cool feature just like that. But what I hadn't thought about before, is that you can use a Content Part on several pages throughout your site, and let every Content part have the same content, just by giving them the same "ContentName". Like a content virus, that spreads itself all over your site. :-) If you change the content from one of the Content Parts, every Content Part with the same "ContentName" gets updated.
If you look at the default.aspx in an editor, you can find one of the Content Parts (let's call them CPs from now on), that looks something like this:
<cs:ContentPart runat = "Server" contentname="featured" id = "featuredContentPart">
- some content here -
</cs:ContentPart>
To try out what I am talking about in the beginning you could for example create a new CP like this:
<cs:ContentPart runat = "Server" contentname="MyTestCP" id = "testContentPart">
<h4 class="CommonSidebarHeader">Test title</h4>
<div class="CommonSidebarContent">
test content
</div>
</cs:ContentPart>
The red html code is just something to fill up the CP with so you can find it on your page and double click it. The first time you fill in your new CP and save it, the content will be saved to your DB. The red html above will get you a box like the ones you see on the right side of a default CS install, so why not use it the first time you fill in the CP.
If you placed the above CP on i.e. the default.aspx, try put the same code in i.e. the forums default.aspx somewhere in it's sidebar. Then browse your side and start editing one of the CPs, browse to the other page where you put the same CP and you see it's updated.