Another day, another [csl] add-on!

A member in the [cs] 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 [cs]; 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 (5) -

Kingsley Tagbo

Does this go back and retro-fit all your blog posts with the signature or is it only for newly added blog posts?

Sean Kearney

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.

Richard Dudley

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!

Ryan Farley

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!

Sean Kearney

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

Comments are closed