I should note that this is using the ‘old blogger’ and I haven’t updated to the new blogger. I believe it should work with new blogger as well. Anyone who tries it should let me know.
Since there PHP isn’t available, you need to find a different way of encoding the title and name into acceptable URL formatting. I used javascript to do this.
The three values that I retrieved from blogger are the URL, the Title and the Author. They are <$BlogItemPermalinkURL$>, <$BlogItemTitle$>, and <$BlogItemAuthor$>. I did not use the date variables, <$BlogDateHeaderDate$> or <$BlogItemDateTime$> since they would need to be formatted properly for NewsTrust and it may conflict with the way dates are used in the blog. I also did not use <$BlogItemBody$> which is probably the best way to set the story_quote parameter. In my case, I too often bury my lead, so using the beginning of the BlogItemBody wouldn’t make a great quote.
To make this work, I created a javascript function which I put in the head of my blogger template. Here is the function:
function newstrust(url,title, author)
{
x='http://www.newstrust.net/webx?storySubmitBookmarklet@@!'+
'url='+url+
'&title='+encodeURIComponent(title)+
'&story_type=Blog%20Post'+
'&publication_type=Blog'+
'&publication_name=Other'+
'&unlisted_publication_name=Aldons%20Blog'+
'&journalist_names='+encodeURIComponent(author);
w=window.open(x,
'newstrust',
'dependent=yes,scrollbars=yes,resizable=yes,alwaysRaised=yes,status=yes,directories=yes,location=yes,menubar=yes,toolbar=yes,width=540,height=700,modal=yes');
w.focus();
}
You will note that I hard coded that it was a Blog Post, from a Blog that is not in the set of listed blogs, and that it’s name is Aldons blog. You will want to change these according to your own needs.
Then, in the Blogger section, immediately before the ItemPage section, I added the following line:
<a href="javascript:newstrust('<$BlogItemPermalinkURL$>','<$BlogItemTitle$>','<$BlogItemAuthor$>')"><img src=http://www.newstrust.net/webx/Images/newstrust/buttons/buttons_gif/newstrust_small_button.gif alt="Rate on NewsTrust"></a>
So, with this, I now have a Rate on NewsTrust link. Test it out. Let me know how it works, provide any feedback you can, and let me know if you use it on your blog.
Update 11/12/2007: NewsTrust has updated their site, and I've updated this message to reflect the changes. Most importantly, you should now use http://www.newstrust.net instead of http://beta.newstrust.net
In addition, they have added server side javascript to make it easier to add the Newstrust button.
<script type='text/javascript'>
newstrust_icon = 'http://www.newstrust.net/Images/newstrust.gif';
</script>
<script id="newstrust_button_script" src="http://www.newstrust.net/js/submit_story.js" type="text/javascript"></script>
However, I could not get it to work in Blogspot. In addition, on other platforms, this is good for when the visitor has the specific story open, but isn't good for pages that list multiple stories on it.
1 comment:
Thank you for coding the News Trust button for old Blogger AND for new Blogger. I'm just about to try it out now on blogger (I just found News Trust, I'd been at Newsvine, which is nice too).
Anyway, I'm going to rate you right now, rather than wait to check if the button works, cause I'll probably forget. Plus you did a lot of work over nearly 3 years, someone should rate you by now!
Post a Comment