Syndicated Blog Post Signatures in Community Server
2007-01-31 | Community Server CarKnee BundleAnother day, another Community Server add-on!
A member in the Community Server forums needs a way to add a statement to every blog post that is syndicated in order to prevent scrapers from "using" their content with no mention of the rightful owner. This seems like a real good idea for anyone, including me, who syndicates their content. Jose Lema came through with the basic idea of how to handle this situation so I figured I would run with it.
The code, as Jose provided, is real simple however I wanted to make it easy to change the "RSS Signature." I figured we could store the signature text in an ExtendedAttribute rather than a config file so here is what I have:
public void Init(CSApplication csa, XmlNode node)
{
csa.PreRenderPost += new CSPostEventHandler(csa_PreRenderPost);
}
void csa_PreRenderPost(IContent content, CSPostEventArgs e)
{
WeblogPost post = content as WeblogPost;
if (post == null)
return;
if (e.ApplicationType == ApplicationType.Weblog && e.Target == PostTarget.Syndication)
{
string sig = post.Section.GetExtendedAttribute("BlogRssSignature");
if (String.IsNullOrEmpty(sig))
return;
post.FormattedBody = String.Concat(post.FormattedBody, sig);
}
}
Now for the Control Panel Administration of the signature. I do not like modifying the core code for Community Server; it makes it a pain to handle updates. So what I did was create a new page to handle the setting of the extended attribute, with the codebehind residing in my bundle. The result is a simple page to create/edit the signature text used for your blog. I should also mention that I dislike having to edit language xml files for basic text. Again, this is just a pain for installing quick modules, but if you are using any language other than English you will have to manually edit the aspx file.
Create your signature:
And here it is:
To install this, download the bundle and follow the instructions in the readme.txt file.
Comments
2007-02-03T01:13:55.0000000Z
Does this go back and retro-fit all your blog posts with the signature or is it only for newly added blog posts?
2007-02-03T01:50:07.0000000Z
Kingsley, This module will append the text to the Rss/Atom feeds for EVERY blog post you have made. It will not alter the text in the database so you can disable this module and your blog post will go back to normal.
2007-02-03T04:15:07.0000000Z
Friggin awesome! Since I was the one who asked the question and hadn't gotten around to working through Jose's answer, I'm thrilled. Thank you!
2007-02-03T08:23:45.0000000Z
Awesome stuff, thanks for sharing. BTW, I don't suppose there is any way to append the sig to the posts in the site's main feed as well? Thanks!
2007-02-06T00:07:11.0000000Z
Ryan, The settings are on a "Per Blog" basis. If Blog A has a signature set, it will be displayed in the MainFeed. If Blog B doesn't have a signature set, then there will be no signature to display in the MainFeed. If you want all of the blogs on your site to have a signature then you will have to modify the settings for each blog. You could also modify the AggregateRssHandler.cs file in the CS core to alter the text of every post that gets aggregated. -Sean