Blogger Hacks, Categories, Tips & Tricks

Tuesday, July 18, 2006
Sidebar Comments and Hearsay
Comments are the life blood of a blog. Whether from regulars or people just passing through, having a say is the essence of blogging. In this post, I review the various methods for getting your most recent comments into the sidebar of your blog, where they belong. I also unveil a new hack, Hearsay, which helps format and display your readers' comments.

Motivation


After writing up a few entries on comment feeds for the Blogger Hack Wiki, I thought I'd road-test a few methods to get it up and running on my own blog.

My brief was simple. I wanted "near-real-time" comments (say, 10 minute delay), displayed on each page along with a timestamp, the author and a link to the original post. I also wanted to show the first few lines of the comment and have control over the number of comments displayed. Any code should be lightweight and not stress my diskspace, bandwidth or the user-experience. Some AJAX-stuff might be nice. Oh, and did I mention it had to be free, secure and entirely lacking in hassle?

Dead Ends


The first method I looked at was Blogger's own recent comments "hack" (I use the term begrudgingly). They point out that this will only display comments for posts on the front page, in the order of posts. On my blog, most comments are on past posts and I only keep three on the front page (long articles), so this is useless.

Next, I tried the Farrago Recent Comment Hack (as featured here on Freshblog). I found this suffered from the same limitations as the Blogger one, albeit formatted a little better.

It dawned on me that formatting wasn't the issue; getting my hands on a comment feed (preferably RSS) was the thing. But how?

I moved onto one I was hopeful about: Singpolyma's Mailbucket hack. This involves setting up your email account to forward your comment notification messages to a Mailbucket email address, which in turn publishes it as an RSS feed. It is a mail2rss application and took all of two minutes to get up and running. Very cool.

Unfortunately, the HTML of each comment gets "lost in translation", so important information - like the URL of the post! - disappears while the rest is mangled. It can be recovered on HTML pages that Mailbucket provide, but then I'd have to scrape those so ... what's the point of getting it as RSS? I don't mind telling you that this was a big blow, and I even got underway a still-born effort to cobble something together with iframe elements pointing to Mailbucket's HTML page. (That is one hack will stay locked up in my dungeon lab, never to see the light of day.)

So I tried a variant of this approach, using Shantanu's Google Groups hack. The idea is to forward comment notification emails to a special Google Group setup for the purpose, and then tap it via RSS. A little more hassle to setup - fortunately I had a Google account - but the result was the same disappointment as with Mailbucket. Messages were truncated. Stuff got chopped out. Bits were missing.

I toyed with Thom Shannon's excellent Blogger Comment Feeds hack. Good as this is, it requires a BlogID and PostID to fetch all comments for a particular post. I doubted that this could be re-purposed to get recent comments across all posts. Not without doing something really, really, ugly. And regretable.

A Path Clears


OK - that left me with one option: Amit Argawal's Comment Feed Using Another Blog hack. The implementation was a breeze: create a new blog, strip out most of the template and set it up to receive (and publish) emails from my Gmail account. Then, setup my Gmail account to forward comment notifications (as above) to the new blog. Now I can securely and automatically capture comments and get the comments as HTML, RSS, email - and it took about six minutes! Brilliant.

[NB: Call it superstition, but I'm uncomfortable about search engines finding a large repository of content word-for-word identical with big chunks of my blog. I figure it would count against me in search engine rankings and something could accidentally get labelled a splog. For that reason, I try to keep the location of my comment group and blog a secret, using the various "do not publish/ping" type options ... I suggest you do the same too.]

One Hurdle ...


Now, I was getting fully-fledged RSS and Atom feeds, replete with well-formated HTML and important timestamp and other info. I pumped the resulting comment feed through good ol' Feedburner, to collect stats and other goodies. Now, for the display: Feedburner's RSS-to-HTML service was a problem in that the fields referred to the comment blog, not the post blog. That is, the titles of all the "posts" (actually, comments) were like this:

[The AFL Player Spectator] 7/11/2006 05:19:22 PM

the URLs pointed to my comments blog (instead of my "real" blog) and the author was always me (since the comments were forwarded from my Gmail account). This problem would also afflict the RSS-to-JavaScript solutions out there too. Fortunately, the required information about URLs, timestamps, authors etc was in the bottom of the RSS description field (as Blogger kindly put it in the footer of the notification email).

What's needed was a script to extract the info from the feed and make a nice presentable chunk of HTML for display. This would also mean you could publish multiple comment feeds from different blogs on any page - not just blogs. Mull that over!

The Way Out


Enter "Hearsay". This is a legal term for (roughly) repeating what someone else said. I call it this because comments go from Blogger, to Google, back out to Blogger, to Feedburner, to Ning and finally to the reader. (Honestly, I find it's best not dwell on it.)

Anyway, this script grabs the RSS feed of your comment blog (perhaps via Feedburner, perhaps not), runs it through Singpolyma's XOXOtools Ning app for conversion to JSON for some poor-man's AJAX-style asynchronous rendering, based on my backlinker hack. (No, I'm not just mashing my fist on the keyboard - these are all real words.)

Long story short, if you want recent comments in your sidebar, setup a Comments Blog, then put this in your main blog's template header:

<script type="text/javascript" src="http://ghill.customer.netspace.net.au/hearsay/hearsay-v01.js">
</script>


And put this in your sidebar where you'd like your really most recent comments to magically appear:

<div id="recent-comments" ><center><br/><br/><br/>Please wait ... <BR/>loading comments.<BR/><BR/><img src="http://ghill.customer.netspace.net.au/snake_transparent.gif"/>
</center></div>
<script type="text/javascript">
hearsay("http://feeds.feedburner.com/MyCommentBlogRSSFeed", "recent-comments");
</script>


Replace the URL with your comment blog's RSS feed. That is, not the atom feed (atom.xml) - the RSS one (rss.xml). That's it. You can check it out in action at The Speccy - scroll down and look for comments in the sidebar. (I apologise in advance if any of you blanch at the level of venom in the comments; it's the nature of my blog.)

It displays a list of comments, including a description comprising of the author, "friendly" elapsed time, title of the post and URL of the post. You also get a short summary and, on mouseclick, the full text of the comment. (Formerly mouseover - thanks Johan, for the advice.)

Of course, you can tweak it. (Hey, this is Blog Hacking, not Blog Cut'n'Paste!) You can set the number of comments (default is 5) and the maximum number of characters (truncated to the last whole word) by putting this in the script above, just before the hearsay(...)

comCount=5; comSize=100;

You can also add styles in your style sheet. The description has class="hearsay-descr", the summary is "hearsay-summary" and the full text is "hearsay-full". You might like to add some CSS like this:

.hearsay-full
{
border: solid black 0.2em;
padding: 0.2em;
margin: 0.2em;
color: #222;
}


to make a border appear around the expanded comment.

Lastly, I added a little button that will "grow" your list of comments:

<div id="more-comments"><center><span style="font-style: italic; padding: 0.5em;" title="Display next five comments"><a onClick='comCount+=5; HSProcQuery(JSONfeed);'>Older Comments</a></span></center></div>

You can change the 5 to what ever you like. Eg comCount*=2 will double the list with each click. Based on similar logic, you could make the summary size grow or shrink too.

Please feel free to use the hack (human-readable source code here) and make any modifications you like (it's licensed under Creative Commons). I'm still feeling my way with this stuff, so I'd be delighted to hear of any suggestions about the code or presentation; what would you want to see in a sidebar comment solution? Drop us a note below ... who knows where your comment might end up.

Filed In:
Posted at 11:34 AM by Greg.
77 Comments:
<    >
Blogger Johan Sundström said...
Wow! :-) An astonishing show of the kind of thing you can put together with a bit of human ingenuity, scraps and pieces of the free online services on the web back yard, in avoidance of setting up your own server side code.

(Incidentally also the path I chose for ecmanaut to get out of the habit of server side hackery. :-)

Great research and execution, Greg! (I think I'd go with the "click to expand" approach, by the way; it's a bit puzzling that comments go away when you happen to mouse out before having read through them.)

<    >
Blogger Greg said...
Thanks for the kudos. A mate of mine is a PHP developer and when he sees these things he too is amazed (perplexed?) at the lengthgs I'll go to do avoid server-side code.

Let's not forget sending a big shout-out to Singpolyma and his XOXOtool Ning app thingy that lets me convert RSS to JSON on the fly! It's opened up a world of hacking possibilites.

Oh, and I changed the mouse events to clicks - seems to work better.

<    >
Blogger Unknown said...
Sounds interesting (Relay hack!) after a quick browse through. Will spend more time later to understand and get it working with my blog.

<    >
Anonymous Anonymous said...
A wish come true! Very cool. One slight disadvantage is that the link just goes to the top of the comments section, rather than to the *particular* comment (like with the Farrago hack). But I don't suppose there's any possible way to extract the comment id# from the emailed comment info?

<    >
Blogger Greg said...
Thanks for the reminder - yes, I commented on your earlier wish-list, but focused only on the categories stuff! Forgot about the comment stuff, but this looks like it hits the nail on the head. Lucky you ;-)

Sadly, the exact comment ID is not passed in the Blogger mail, so it cannot be recovered. I added "#comments" in the hope that it will direct users closer to the action.

<    >
I attempted to utilize this code, and got this pop-up box:

Error: hearsay: could not process comment: undefined

Would you know why?

peace...
annie

<    >
Blogger Hannelore said...
Almost the same here.

The pop-up-box says:
Error: hearsay: could not process comment:

and in the field is all that code,
which seems to be the code of the post with the last comment (from div to div).

This is weird, because all your other hacks are working like a breeze ...

Danke,
Hannelore

<    >
Blogger Greg said...
I'm sorry to hear that!

The error means that Hearsay couldn't apply the regular expression that extracts the author and URL of the comment. Specifically, it's looking for (but can't find):

"Posted by [blah] to <a href=[blah]"

towards the bottom of the post.

RegExps are notoriously fiddly beasts. I had a look under your Blogger profiles for your new comment blogs, but couldn't see any.

Perhaps if you post (or send to me) the URLs for your respective comment feeds, I can have a look at them and see why the script is falling over.

Thanks for implementing the hack and giving me the feedback!

-Greg.

<    >
Greg, Maybe I completely missed something in the post. I tried to understand the first part of your post, but was lost. I thought it was other attempts at this hack. Then I got to this part and thought it the instructions:

"Long story short, if you want recent comments in your sidebar then put this in your header:"

So, I followed the instructions from there on.

Long story short...I don't have a comment blog. I'm guessing I better re-read the first part of your post and try again.

peace...
annie

<    >
Blogger Greg said...
Hi Annie,

Yeah, it's not the most straightforward post - very long and convoluted. In hindsight, I probably should have done it as two posts. And used headings. (John has set a new benchmark for clarity in blog hack posting with his trackback tutorial.)

The upshot of the first part was "hey, none of these hacks works like I'd hoped".

The second part was "Hmmm, setting up another blog for comments has potential".

The third part was "Here's a new hack that will take the comment feed and display it properly."

It's a bit clearer on the wiki.

-Greg.

<    >
Blogger Hannelore said...
Thank you Greg. I checked out the wiki and in combination with your post I got some clues and made alterations to things I misunderstood.

Now I am at the same state as anniebluesky: the message in the error window says "undefined" :-)

I didn't add the comments blog to my profile, now I have, and changed the language from German to English, too - maybe its easier for you to find, what's wrong.

Oh, and I'm using the included blogger atom feed. Which works fine in my reader, but could this cause the error?

Set up in 6 seconds? No way ;-)

I appreciate your help, thanks,
Hannelore

<    >
Blogger Greg said...
Hi,

Yes, it's working for you!

The catch is you need to use the rss.xml feed, not the atom.xml one. I'll update the instructions to reflect that.

I just tried out your comments by visiting my blog (with Hearsay installed) and typing this into the browser:

javascript: hearsay('http://kommentare-matriarchat.blogspot.com/rss.xml', 'recent-comments');

Worked like a charm.

Sorry that's it taken more than the six minutes advertised ... it's entirely due to my bad instructions.

You should be able to remove it from your public listing now. You can also offer the comments feed to your subscribers by putting one of those orange XML buttons on your blog pointing at this feed.

Noch einmal, tut mir leid!

Tschuess!

<    >
Blogger Hannelore said...
YES!!
Thank you very much, Greg.

And if you're at it updating the instructions, you could mention, that anonymous posts are not shown. (As far as I can see)

You know what? The poor internet shrunk for me to almost one website during the last couple days: Freshblog. I have to commit, that I got obsessed with blog hacking.

Tschüss!

<    >
Blogger mina said...
hi Greg,
a very good hack. I've tried it on my site (http://j-mave.blogspot.com). At first, I got problem like anniebluesky did, but after I changed the .xml, it worked out fine.
The problem is, it still doesn't satisfy what I want. Apparently, it doesn't show the MOST recent comments from previous pages.

<    >
Blogger mina said...
Hi again :D

I am wrong. The comments, for whichever previous pages, should always appear in the Recent Comments.

I think the problem is in Gmail. I used gmail for forwarding the email from blogger to my commentsblog. I checked my gmail account, and I saw that from 2 comments I wrote, only one was forwarded to my commentsblog. I don't understand why. There's nothing wrong with the gmail filter, since the first comment I wrote got forwarded correctly and showed up in the Recent Comments in my main blog.

<    >
Blogger Greg said...
@Hannelore: Macht nichts ... Anonymous comments are displayed (check out Speccy), but if Blogger is dropping some then you may have the same problem as below.

@Mina: Thanks! I've noticed that Blogger has dropped some of my mails too. I've sent Blogger Support an email asking why. I suspected Blogger might see this as a splog (spam blog). But, it should be saving the emails as drafts - which it's not, for me at least.

In the meantime, the dropped messages can be forwarded manually, which seems to work fine.

(Hearsay ignores the subject line and any sigs you may append to the email, but it's probably a good idea to delete the "from: ... ", "to: ..." etc block at the start of the forwarded message.)

I'll let you know when I hear from Blogger Support.

<    >
Blogger Richard Y Chappell said...
I have the mail-to-blogger problems too. Even manual forwarding didn't make any difference. Some comments get through, but others don't. It seems entirely erratic. I hope Blogger sort that one out soon!

As for the wonderful hack, I have one suggestion: To save space, can you make it so that the "older comments" replace the five that were previously showing (rather than being appended below them)? You could then have a "newer comments" button appear so readers can cycle back and forth. That'd be neat.

<    >
OK, in the last 2 days I have survived a tornado (while sitting a local tavern waiting on my fish & chips, which BTW never materalized) been without power and cursing the neighbor with a noisy generator. Fired up the grill and made a feast fit for a King. (My freezer was slowly defrosting.) Waiting...for the power so I could go at this hack again. Finally, POWER...internet...no hack love :-(

I have opened more accounts and adjusted more settings, but the best I get now is that same error message, but the box is now blank.

My comment blog is public, so you can take a peak and see what the problem is...if you can. Let me know.

The crazy part is, I seldom get comments and yet I must have this hack up and running. I'm obsessive. compulsive. At least I know my faults.

peace...
annie

<    >
Blogger Greg said...
Hi Annie,

The good news is that your Hearsay is nearly good to go ... I just tested your blog out with my comment feed:

javascript:hearsay('http://speccy-comments.blogspot.com/rss.xml', 'recent-comments')

There's just two points:

1) Your comments blog is empty. I just posted a comment to Blog U and it doesn't seem to have made its way over. Can you please forward it manually, or otherwise get a couple of test messages in there?

2) When I tested your layout with my comment feed, it only displayed the first comment. I wonder if this is because your "recent-comments" div is wrapped in UL tags? (Hearsay generates it's own UL tags, with each post in LI tags ... you could "nest" that in other UL tags, but it might require CSS tweaking.)

Just a bit more OCD in between natural disasters and I think we'll be there ...

<    >
Blogger mina said...
Greg,
yes, I already tried forwarding the mails manually. Things looked OK i gmail. After 3 times trying, only 1 got through into my commentsblog, but the comment wasn't posted because it was saved as draft. I am sure the problem is in Blogger.

annie, I have visited your site. It's a nice help for newbie bloggers like me. I will put some comments on your pages next time I visit. I have problems with internet connection here :(

<    >
Blogger Singpolyma said...
Any particular reason you tried every kind of comment syndication except mine? ;) I suppose some people find the requiring XML well-formedness (which I actually don't quite do anymore, and never required XHTML validity, as some have believed), and really should rewrite it some to use Tidy or something and remove that limitation... but anyway, it provides JSON(P) out of the box and the URLs to actual comments. Just a heads up in case you hadn't seen it ;)

<    >
Blogger 失踪 said...
thank you so much i made it!! after seven hours. so i'm a newbie. i neither had a google-mail-account nor any experience with RSS. blogger.com was/is rather reluctant in publishing the forwarded comments on the comment-blog.

<    >
Greg, just shoot me! All of my comments are ending up as drafts in my main blog.

Singpolyma, I didn't know about your version. I'm at work, so when I get home I will give it a go.

That is unless my blog stops holding my comments as draft hostages and lets them free, in which case, all would be well.

peace...
annie

<    >
Apparently the moon is in the Seventh House and Jupiter is aligning with Mars...it is working!

Two comments have escaped from the black hole and managed to display themselves in the sidebar!

Let me take a breather before I start tweaking it...how many will be displayed at a time (assuming, of course, that I will get another comment), how to change the 'intro' to the comment, how much of the comment will be displayed, etc.

It's hard being OCD!

peace...
annie

<    >
Blogger Greg said...
Hello all,

First, the good news. It seems that the disappearing mails are a transient phenomenon. According to the Blogger Google Group, it's been happening for about a week now. I hope that we'll see an improvement in the situation shortly. I have already logged a request directly with Blogger, and another one on that forum.

I've seen Blogger's tech support answer queries on this Group before, so I'm guessing that a bunch of "yeah, me too!" posts might shift an issue up their priority queue (hint, hint).

@ Annie and Mina. If your blog is saving the emails as drafts, then that is a different problem from the one we are experiencing.

1) When setting up your "inbound" email address on your comment blog, there's a check box called "publish". Make sure this is checked, as it causes Blogger to directly publish the messages.

2) If you get word verification, then Blogger has decided you are running a splog (spam blog). This can be fixed.

@ Richard. Yes, more buttons can be added in future releases. (NB: future releases are conditional on the current problem being rectified.)

@ Singpolyma. I'm sorry to leave your solution out ... I did look at it but the requirements/instructions deterred me. And, to be frank, I thought if it deterred me it would down-right frighten a lot of other people. :-)

My mindset at the time was "Yes, all my blogs should be well-formed XML, despite the congealed layers of template hacking, add-ons and half-forgotten extensions. I should also visit the dentist twice a year, clean my books out of my Mum's attic, give blood and re-org my spice cupboard."

Now, maybe the requirements have been relaxed and the hassle-factor has dropped. Or maybe I'm overstating how hard it is to achieve validity? I hope so, since your approach is a much better jumping off point for something I'd like: tag-based post/comment feeds ie feeds for all posts (and/or comments) which feature one or more tags. (Perhaps I should add that to the other comment hack I've requested.)

Please look into the revised "addability" of your hack and report back to us with what you find. I'd like to see Hearsay's presentation code working with your comments feeds - individual comment IDs would be great!

<    >
Blogger Dave said...
Greg,

I've got your hack up and running on disciplemexico.org after a few failed attempts due to missing the posted by information on my test. I have to say, this hack is very slick indeed. One question: how does hearsay order the individual posts?

I had sent several comments to my comment blog at the same time (yes I too had problems with blogger mail), and then I changed the dates of the posts to match the actual dates of the comments. However, I have some comments showing up as "older comments" even thought they are only a matter of days old, while comments two weeks old are appearing on the main list. Any suggestions on how to force hearsay to order my comments from newest to oldest?

<    >
Blogger 失踪 said...
disappearing comments: could it be that it depends on how you forward your comments from googlemail? i changed my settings in googlemail and since it worked fine: in FILTERS you choose the "filter by subject" option and tipp in your blogger identity which appears in every mail as "subject" and forward it to your mail-to-blogger-address. don't change anything in FORWARDING AND POP. there you keep the initial settings ("disable forwarding").

what's your experience?

<    >
Blogger Greg said...
@ Dave

Looks good!

Re: ordering. Hearsay doesn't do any sorting of its own; it takes them in the same order as the feed. My understanding was that Blogger's RSS feed (and hence FeedBurner's relay) would be correctly ordered, including allowing for updates.

From what you're saying, that is not the case? I will look at putting some re-sorting logic (by date of comment, not any updates) into Hearsay.

Thanks for the feedback.

@ 失踪

I've only ever used the "filter" option in Gmail ... but still experiencing drop-outs :-(

FWIW, my comment notification emails' subject line has the form:
[Blog Title] m/dd/yyyy hh:mm:ss xM

No Blogger profile in there. Still, I'm pretty sure the emails are getting out of Gmail okay, it's getting them in to Blogger that's the problem.

Thanks for the tip.

<    >
Blogger 失踪 said...
yes, you are right, the problem is the same again. it must be blogger, not googlemail.

<    >
Blogger Dave said...
I figured out the ordering of the rss.xml. Blogger places the most recently edited post on top, so to fix the ordering problem, I went through and "edited" the posts in the reverse order of how I wanted them to appear (oldest to most recent.) Feedburner doesn't seem to be suceptible to this problem, but the feed doesn't seem as reliable either.

Hope this helps the process along. Again, thanks for giving us another reason to stick with Blogger.

<    >
Blogger Richard Y Chappell said...
At least Blogger are aware of the problem, I just received the following response from their help desk:

"Thanks for reporting this issue. We're currently investigating some issues which are causing Mail-to-Blogger emails to post inconsistently. We are working hard towards a solution. In the meantime, you may need to post using the normal Blogger interface. Thanks for your patience."

<    >
Blogger Greg said...
Yes, I got a similar message from Blogger Support. Also, people on the News Group have reported seeing error messages from Blogger's mail service that seem to indicate capacity issues.

On the plus side, my last four comments went straight through! Assuming a 30% "acceptance rate" (the average to date), the odds of that happening by chance alone are less than 100 to 1. Looks promising ...

<    >
Anonymous Anonymous said...
Say, I notice the hack is currently not working on my page (viewed with I.E.) - it gets stuck on the "please wait" message.

Also, the "Older Comments" button apparently lacks a closing italics tag, judging by the look of all the italicized text below it in my sidebar!

<    >
Blogger Greg said...
G'day Richard,

I haven't changed the code, so it may be a pathological comment instance.

I checked your page (under IE6.0.2800) and it seems fine. I also couldn't find any problems on other installs. Can you replicate the circumstances when you saw it?

And, yes, the above code snippet was missing a closing span tag ie </span>. I've updated it in the post.

Thanks for the pickup!

<    >
Anonymous Anonymous said...
Not to worry, it seems to have come unstuck by itself. Maybe it was just my computer playing up.

<    >
I temporarily removed hearsay because things just got ugly. I was missing comments, they weren't coming through. It was more than I could deal with. When blogger gets the mail-to-blogger issue straightened out, I will install it again. I can't wait!

<    >
Oh, one more quick question...can you use 'comment moderation' with hearsay?

<    >
Blogger Greg said...
Hi Annie,

I'm sorry the recent Blogger problems have caused you grief! They assure me they're getting it sorted out, and I'll post here when that happens.

Re: Comment Moderation. I'm not 100% sure how that works, but Hearsay works on the comment notifications emails; once that's sent, it will end up in Hearsay.

I guess Blogger sends the comment notification email prior to you confirming it? In which case, maybe you could untick the "publish" option on your comment blog, meaning that you'd have to manually approve comments in that way? Not super convenient though ...

<    >
Blogger Singpolyma said...
@Greg -- Will definately be looking into making my hack easier to implement. Unfortunately, many people confuse well-formedness with validity, but either way it has confused too many people. I've just been too lazy to re-investigate, but I'm sure it should be possible if I decide to go at it :)

<    >
Blogger Greg said...
Please, Singpolyma, look into making the whole thing easier and I'm sure people will take it up!

Also, I've noticed that the published dates in my comment feed's RSS file all got reset to yesterday (1st of August). This is bizarre and not very helpful. It also seems to have affected the "updated date" in both the RSS and Atom feeds.

Maybe it's something to do with being the first month boundary of a new blog? Maybe it's something to do with the failure to publish emails 100% reliably. Either way, it's annoying to lose date information like that.

Has anyone else experienced this?

<    >
Blogger Greg said...
I've checked out a few of the implementations (to add to the wiki) and no one else seems to have suffered from the date reset phenomena. Just me :-(

On the positive side, I've had the last 15 comments sail through without a glitch, and Blogger Support assure me all is well.

Has anyone else noticed any dropped comments in the past three or four days?

<    >
Blogger mina said...
Dear Greg,
I think Blogger already solved the problem of Mail-to-blogger. My recent comments worked out fine! thanks Greg :)

<    >
Blogger 失踪 said...
@ greg: you were not the only one who suffered a date reset phenomena. my recent comments changed suddenly on july 31 and showed the comments of a week ago (july 24) as most recent. i deleted the comments from july 24 but after a few hours the same happened again. but it seems fixed now. also the mail-to-blogger problem has vanished. the recent comments are working very well now!

<    >
Blogger Greg said...
Great to hear it's working for you all, too. (I've also got confirmation from Richard.)

Perhaps I should look at a second release. We've already had a suggestion for a "earlier" button (to complement the "older" one). Any others?

<    >
Blogger 坚硬的泡沫 said...
it's soooo not easy, i tried couple of hours but always got

"please wait...

loading comments"

any suggestions????

<    >
Blogger Turbo said...
awesome!!

<    >
Blogger K said...
I have been working on this project myself for 2 days before I came across this site. Cheers!!

<    >
Anonymous Anonymous said...
This is great. I still haven't solved a problem with the header information (the header gets published and then the "recent comments" section just shows a bunch of headers in the summary). For the moment I've just deleted the headers manually.

But why the heck doesn't Blogger offer this function as one of their new page elements? Why didn't they introduce a decent recent comments function years ago?

Maurice
mauricepigaht.blogspot.com

<    >
Anonymous Anonymous said...
my recent comments have gone crazy. I'm not getting the most recent, and it's only posting ones from four days ago. Can somebody help.

<    >
Blogger Greg said...
Hi Kevin,

Are the notification emails from Blogger still coming? Are they getting forwarded properly? Are they showing up in your comments blog okay? Are you getting in any warnings or errors?

Cheers,

-Greg.

<    >
Anonymous Anonymous said...
I'm getting nothing. The recent comments is not up dating and neither is my comments blog. I'm still getting comments to my posts, they're just not showing up in the comments blog or the sidebar recent comments. All worked great up until a week and half ago.

<    >
Blogger Greg said...
Hi Kevin,

You'll need to get your comment notification emails turned back on. First off, check that the option is still enabled in your (original) blog. Do a few tests. If the emails aren't coming through, lodge a support request with Blogger.

<    >
Blogger Greg said...
If you're into Blogger Beta and would like a similar end-result, you should be able to just insert your recent comments feed into the RSS sidebar widget.

Some people have reported problems with this, so you can continue to use Hearsay or take advantage of the hack from 失踪 for scraping your comments with Dapper.

<    >
Blogger TheShaz said...
This is great.

OK it took about 30min to get it up. I telecommute so I was working and "playing" at the same time :-)

Looks good. I will publish it later today. I was using Farrago recent comment hack and for some reason it just hung the site up and your CPU usage goes thru the roof. Was working fine for months then boom Hangville.

www.bucklesw.blogspot.com
American Circus History

TheShaz

<    >
Anonymous Anonymous said...
Hi Greg !

I tried your trick here. I managed to go through the email-publishing stuff, but as a result, I get the "wait" picture forever. What's the problem ?

I also tried the direct Blogger method, but I need to hack it to show only the last five comments.

And, as a last question, I wonder where to find the "sidebar widget for beta blogger" that I'm reading in many blogs. I've switched to Blogger Beta, but I don't find where to simply put my Comment RSS feed !

thanks for your help

<    >
Blogger Greg said...
Hi Matthieu,

I had a look, and you need to replace your HearSay call with this:

hearsay("http://matthieu-test.blogspot.com/feeds/posts/full?alt=rss", "commentaires récents");

1) If you don't use FeedBurner, then you can't specify them in your source URL.

2) The second parameter specifies the ID of the div to put the results into.

Bon chance!

-Greg.

<    >
Anonymous Anonymous said...
it worked, thank you !

<    >
Blogger mina said...
Lately Blogger considered my comments blog as a spam blog. I had to edit the comments one by one since Blogger put word verification under every post. I already contacted Blogger on this, hopefully they reconsidered.

<    >
Blogger ik - advalvas said...
Hi,

I have been trying to implement the hearsay hack on a new team blog I'm setting up at Blogger: http://versbloed.blogspot.com. I set up a comments blog at http://versbloed2.blogspot.com and configured the first one to forward comment notifications through a gmailaddress to the comments blog. It all seems to work fine. So far so good.

I then put all the code where it should be and alas all i get is the loading pic like forever...

I noticed in one of your advices above that there could be a language issue (f.e. "commentaires récents"), so i tried every Dutch translation of "recent comments" I could think of. But i still get the same script error:
line: 9
char: 848
error: 'HStargNode' is empty or no object

And of course the loading pic :-)Which is already an improvement. At first I tried it with a feedburner feed address and that gave me only the empty box some other people mentioned. The blogger comments feed address seems to work better.

For the moment this blog is only readable for the authors, until its press release, probably next Monday. Could that be the problem? Or perhaps New Blogger has something to do with it?

I'm at a loss. I would appreciate any advice, as i would really like to use this hack. I've looked at examples of it and it's just what i'm looking for, if only i could get it to function properly :-)

<    >
Blogger Greg said...
Hi Fatima,

Yes, it's a Blogger 2 thing. I upgraded to the New Blogger about a week ago and found it broke Hearsay in two ways:

* RSS feed changed its labels from "description" to "content"
* The format of the email being sent has changed.

I produced an updated version of Hearsay that accounts for this. (It works for both the old and new, so you won't lose your "old" comments.)

Try using this script instead:

hearsay-v01b.js

It's bad and ugly and was not intended for public consumption as I'm trying to get out of blog hacking and move on with my life ... :-)

Given that New Blogger let's you access your comments as an XML feed directly, I'm sure there are other, saner ways of getting recent comments happening.

Try the wiki or see what Singpolyma's up to.

<    >
Blogger Greg said...
Somewhat oddly, Blogger has switched its RSS feed back to using "description" instead of "content" for its field names. This has been reflected in the script.

<    >
Blogger ren powell said...
At first I got the default error, too. Now it is waiting an eternity to find the comments. Pretty little graphic, though.

Have I done something stupid?

<    >
Blogger Greg said...
Hi Rens,

Try the following:

1) Use the latest version of the script, v01b (see two comments above).

2) Use this function call:

hearsay("http://www2.blogger.com/feeds/841924008233186766/posts/full/?alt=rss", "recent-comments", false);

(where your blog ID is 841924008233186766)

That should do it!

-Greg.

<    >
Blogger ren powell said...
You are amazing!
and generous. Thanks so much.

<    >
Anonymous Anonymous said...
Dear Greg,

I'm going to ask for help, but I also want to express my gratitude for producing such an amazing solution so long ago and helping people with it as recently as five days ago.

As almost all your commentators have said, this is wonderful and appreciated.

Off topic, but I may actually be an Australian one day.

I started "web design" (such as mine is!) with a Blogger blog for my Perth girlfriend, whom I met on the internet and have since met in real life. She's everything I've ever wanted.

“Loving Jacqui” - if anyone wants to drop "Bear" off a comment, guaranteed she will be tickled pink.

That blog I can't spend the time to code right now, but I've just written a new business website (which, except for the things Blogger publishes, is valid XHTML 1.0 Strict and CSS) because I'm looking for a job.

It's to help me find a good one.

I put your script (the new version) on it and it looks great, but I'm getting an error.

Instead of the date of the comment showing up, I'm getting:

"(just now)"

... and when I hover, the tooltip error, "Invalid Date".

I've been troubleshooting for a long time, but I don't really know JavaScript and haven't had much luck.

I get the error regardless of whether I use Blogger's or FeedBurner's RSS.

The feeds are located at:
http://c-pgsb.blogspot.com/rss.xml
http://feeds.feedburner.com/c-pgsb

... respectively. You can click my name to reach my blog, I just don't want to put more than three links here for fear of spam filters.

I turned off the FeedBurner SmartFeed feature to make it compatible for all readers because I want it to stay RSS. I'm forwarding through Gmail and the publishing part is working without a hitch.

Ultimately, I would prefer not to have the comment dates because I don't anticipate getting a huge amount them. As I said, my site is really targeted to a very small market of people who want something sold and want a sales pro to do it.

So I'm wondering if there's any way you could tell me how to remove the date feature from it?

That would be great and would save the effort of fixing it.

Then it would just have this format:

Commentator Name on Blog Post Title:
Comment text...

Either that, or getting the dates to work!

In a perfect world, and this is going way over and above what I have a right to expect, it would even be better if just the Commentator Name was clickable and not the the Blog Post Title.

But that's a really minor thing. Getting rid of the date error and maybe the date field altogether is my big concern! I can erase the "just now" part, but then the parenthesis () still show up and I get the JavaScript "Invalid Date" tooltip error message.

So if I just knew how to get rid of the dates that would work.

Can you help?

<    >
Anonymous Anonymous said...
Oh hey, just in case you do want a link to my blog, it's http://christophdollis.com/blog/.

Have a good one!

<    >
Blogger Greg said...
G'day Christoph,

There's two things going on here. Firstly, Hearsay isn't parsing your comments properly. This is why the date's buggered (aside: when you've been in Australia for some months, you'll appreciate the humour in this sentence.)

When you expand the summary comment, the full comment still has:

Christoph Dollis has left a new comment on your post "Inboxes at Zero (Isn't THAT a Relief!)":

That shouldn't be there.

Secondly, you want to drop the date references.

1) Parsing properly. Given that it's worked on many other blogs, this is weird, and I can only imagine it's due to some bad regular expression on my behalf. One possibility is that your post title has some parentheses and exclamation points in there? It doesn't seem to be a problem on other posts. If it crops up again, send me another note.

2) Dropping date references. To get rid of the tool tip, remove this line:

descr.title=comData.timestamp;

To get rid of the time lag in parentheses, drop this sequence of characters:

('+comData.lag+')

That should be it!

(I just tested it on your blog by running the modified code in the browser. Works fine.)

Please let me know how you get on.

Cheers,

-Greg.

<    >
Anonymous Anonymous said...
Hey, Greg, that's fantastic, and thank you!

It did what I asked it to do.

It looks nice too.

I'm curious about the link. Should the link in the recent comments sidebar go the the exact comment permalink... i.e., http://LONGURL#c360950288289487779 or to the top of the comments section, i.e., http://LONGURL#comments?

Mine is going to the top of the comments.

I'm not sure if it's supposed to be.

Second, was in Perth for three months from January to April. Miss Australia dearly and I'm one of the few people who never had an inkling to visit until I met this lady.

Now Australia has grown on me. Kind of like her.

;-)

Third, I tried to create a link to this post like the other people have where they show up as people who have written about HearSay.

It didn't work. How do I do that?

Thanks!

<    >
Anonymous Anonymous said...
Oh, and Greg, if you check out your MailBucket feed [link], you'll see that the words:

"Greg has left a new comment on your post "Sidebar Comments and Hearsay":

... are still there. I don't think they're supposed to be if I understood you right before.

Did Blogger change anything?

Third, it took me ages to figure out why you or anyone should care about the AFL.

We had something called the American Football League that even Donald Trump invested in.

It didn't make it. Now I'm like, "Doh!" Aussie rules, AFL = Australian Football League.

I quite agree that athletes should comport themselves better. You may have heard of Mike Vicks, the American National Football League star quarterback who was involved with betting on dog fights, killing dogs, etc? He just pled guilty was suspended indefinitely.

Someone with so much money acting so disgracefully. What a fool and good riddance.

Hopefully your players are no worse than that.

Sorry for being so off topic. Please ask me to refrain if it's an issue and I'll just talk regular expressions!

<    >
Blogger Greg said...
1) Yes, it only links to the #comments bit. The actual comment link (#c12345678) is not emailed so it doesn't end up in the feed. Hearsay can't find out what it is, so it makes do with this.

2) I've never been to Perth, but heard it's very lovely. Still, it's all about the people, right?

3) The backlinks will show up in time, once Google has indexed your page and worked out who's linking where.

4) The MailBucket feed shows the "raw" email ... I found it unsatisfactory so made Hearsay.

Re: AFL. I'm sure professional athletes exhibit atrocious behaviour all over the world. Over here, football is taken very seriously. (It's hard to impress upon non-Australians just how heretical a blog devoted to their shortcomings is. It's perhaps akin to publicly barbecuing steaks while living in a vegan commune.)

<    >
Anonymous Anonymous said...
That's great, I love it.

Thanks a lot, Greg.

You helped me put the finishing touch on it.

Also, it updates instantly, like within 30-seconds tops so far, since I use the blogger feed and it seems to change as soon as it receives a new comment emailed to it.

Sweet.

I was expecting every 30-minutes or so which it would have been if I had been using FeedBurner.

I'm sure they'll be some downside to this in the future like Blogger misordering everything after I update a post, but you can't have everything. I don't think FeedBurner sorts that out anyway so no matter.

I know many people like WordPress and I probably would have too had I started with them. Yet I also here of people having database nightmares.

Oh, right, that was TypePad.

:-P

My other blog has BlogKomm comments enabled so I got used to managing the PHP side of comments.

I'll stick with Blogger this time. Hopefully they ONE DAY let you integrate them into your blog's look and feel, but I'm not holding my breath.

Still, Google gives me Gmail, a custom search engine with neat hover disappearing watermark graphic effect, FeedBurner, blog engine... not bad.

So are you a software engineer or is your profession a state secret?

<    >
Blogger Greg said...
Thanks for the blogkomm link, I've not seen that before.

My day job? I trained as an electrical engineer, worked in corporate IT and now I'm struggling to write up my PhD thesis in data quality. I also do "business intelligence" consulting (helping organisations get the most out of their information).

This blog-hacking stuff is one of my hobbies, as I enjoy coding (and blogging). Started on BBC computers in 1988, if you can believe that.

I've had a few jobs, mostly in IT, but I've never been paid to write a single line of code. I hope to keep it that way too :-)

<    >
Anonymous Anonymous said...

<    >
Anonymous Anonymous said...
Hey Greg or ANYONE here who knows the answer, if you could help me that would be fabulous.

I am so lost on how to do something.

One, I got this solution working and it is awesome thanks to you and your personal help, Greg.

The only thing I can't figure out how to do is create a backlink to this post so that the post I wrote about Hearsay shows up in the list of Backlinks on your blog.

This is really important to me because I want to send backlinks to several blogs that relate to the content on mine.

I know you click the "Create a Link" text... and then what?

You get a window popping up you can write a post in.

Do I have to use it? Do I have to leave the link field untouched? Or can I just put a link to this post anywhere? And if so, what link... does it have to end be http://blogfresh.blogspot.com/2006/07/sidebar-comments-and-hearsay.html#links with "#links" at the end or am I way wrong?

To say I'm confused and have no idea how to create a backlink to this post is an understatement.

Can anyone walk me through it?

<    >
Blogger Greg said...
Hi Christoph,

Yes, there's two things going on here. First, there's "backlinks". These are indexed automatically by Google and should show up (eventually) if you put a normal hyperlink to this page on your blog. A "backlink" is just the URL of a page that references the current page. It's like a inverse-hyperlink, in that sense.

The second thing is a "trackback" - this is a bit more involved and the end result is something that looks like a comment, except it's the context on other blogs that mention this page. (Typically, a sentence beforehand and afterwards, like in search results.)

For backlinks, you don't have to do anything - they'll just show up here in time.

For trackbacks, you'll need to fiddle with some software.

Try John's tutorials linked above for more info.

<    >
Anonymous Anonymous said...
Hey, thanks, Greg, I just enabled Haloscan trackbacks on my blog and I think I did that correctly.

Okay, cool... so I don't have to do anything at all for the Blogger backlink to show up here eventually. That is helpful to know.

So just the permalink.

Have a great night!

<    >
Anonymous Jana said...
Comments are important in a blog and interesting to read sometimes.


eXTReMe Tracker