Hacking Disqus

posted by jangro on (4 years, 1 month ago)

No video for this post today. It's just pure geekery that just cannot be made any less geeky or any more interesting by staring at my talking head.

Have I mentioned before that I <3 Disqus? I think maybe I have.

And a big thanks to the disqus guys for adding in a quick feature request I had that allowed me to pull my own disqus comments from every blog into my lifestream here on my homepage.

There are some other features that I'd like to see, and to work that out on my own, I've been doing some hacking and tweaking to get Disqus to do exactly what I want in Wordpress. Here's what I've done so far and how you can implement it on your own.

If you do make these changes, keep a few things in mind:

  1. I did this in the beta version of the wordpress plugin.
  2. once they issue an update, these changes will be overwritten and if they haven't addressed them, will need to be redone. That's the life of a gangsta.
  3. proceed at your own risk.

Trackbacks

Disqus doesn't have any support at all for trackbacks. But since Wordpress will still grab and store them in your comment database, you can still display those. Add the following code somewhere in your wp-plugins/disqus/comments.php script. Be sure to edit the one in the plugin dir. I put mine way down at the bottom.

<h3>Trackbacks</h3>
<ol>
<?php foreach ($comments as $comment) : ?>
<?php $commenttype = getcommenttype(); ?>
<?php if($commenttype != 'comment') { ?>
<li><?php commentauthorlink() ?></li>
<?php } ?>
<?php endforeach; ?>
</ol>

DoFollow/NoFollow

Disqus posts all links in comments as dofollow links. (sans the rel="nofollow"). That's not that bad since Disqus has measures to prevent spammers. But it doesn't stop the comment monkeys.

So I've been playing with a few different ways do put nofollow on some of the spammier comments while taking the opportunity to give dofollow back to the good guys.

Here's what I did, again to comments.php. The bold code is what I added, I've included a little context so you can put it in yourself:

<ul id="dsq-comments">
    <?php foreach ( $disqusresponse['posts'] as $comment ) : ?>
    <?php
     //SCJ added check for rel=nofollow
        if ($comment['points'] < 1 || $comment['user']['isanonymous']) {
            $follow = ' rel="nofollow" ';
        } else {
            $follow = "";
        } 
        //SCJ end change
        $profileurl = DISQUSURL . '/people/' . $comment['user']['profile'] . '/';
    ?>

That sets the $follow var which I just slip into the website link here, down about 30 lines from the first change.

<?php if ( $comment['user']['url'] ) : ?>
    <li><a href="<?php echo $comment['user']['url']; ?>" 
    target="_blank" <?php echo $follow?>>Website</a></li>
<?php endif ; ?>

Feature Requests for Disqus

While I'm at it, here are some feature requests...

  1. Incorporate real trackback support. I don't think I care whether you just use Wordpresses trackback support like I did or try to incorporate it into your service. If you think you can do something about the spammers and scrapers, then by all means take it in. Maybe just allow an option to show trackbacks above or below the comments?
  2. Do something with the Dofollow/Nofollow. I'm pretty happy with the rules I set, which is to add in a nofollow for anonymous commenters and for comments that have been voted down. But something more sophisticated could surely be done and would be welcomed here.
  3. I want more notifications on blogs that I comment on. Right now, I think you send me an email if someone replies to one of my comments somewhere. But if there's a conversation going on in a blog post that I've commented on, I want to know about it. Can I opt to get notified of any reply in a blog post that I've contributed to?
  4. I want to do more with Disqus, namely allow people who read my blog to START conversations, not just respond to the ones I start. I sent you guys at Disqus an email about this with more details. But I really think you guys are just scratching the surface here.
  5. I'm sure your lunches with Loic have you thinking about video comments, so I won't waste a wish on that one. ;)

What do you say, does anybody have other wishes? They're hiring and surely need stuff for that Python hacker to do.


Comments & Reactions

  • Posted by webomatica 4 years, 1 month ago

    Thanks for the Trackback Hack. It will serve its purpose until that feature is added to Disqus proper.

  • jangro saved this to Blogging 4 years, 1 month ago
  • Posted by Vlad Zablotskyy 4 years, 1 month ago

    I did enjoy this post, but unfortunately I am already a subscriber..... Boy that line really jumps at ya.... lol

    Thanks Scott!

  • Posted by Paul 4 years, 1 month ago

    Re: "I could rip off your comment form"

    You can override it by setting these variables right before the javascript code for the comment form:

    var disqustitle = "Whatever You Want";
    var disqus
    url = "
    http://www.whateveryouwant.com";

    You
    can then pull it back using the URL if you go to http://jangro.disqus.com/?url=http://www.jangro.com/a/2008/04/08/hacking-disqus/' href='http://jangro.disqus.com/?url=http://www.jangro.com/a/2008/04/08/hacking-disqus/">http://jangro.disqus.com/?url=http://www.jangro.com/a/2008/04/08/hacking-disqus/'>http://jangro.disqus.com/?url=http://www.jangro.com/a/2008/04/08/hacking-disqus/">http://jangro.disqus.com/?url=http://www.jangro.com/a/2008/04/08/hacking-disqus/

  • jangro

    Posted by jangro 4 years, 1 month ago

    Definitely up for a round. any time!

    Anyone else? :)

  • Posted by Vlad Zablotskyy 4 years, 1 month ago

    Scott,

    I just noticed that with your trakcback hack, the links are "nofollowed". If it was me, I would rather have my comments "noffolowed" but give credit to legitimate pingbacks. Can I remove the "nofollows" from trackbacks?

  • Posted by Vlad Zablotskyy 4 years, 1 month ago

    Thanks for setting me straight on this one ;).

  • Posted by Paul 4 years, 1 month ago

    It would almost have to be a two-step process - Type a title/Choose a category and take them to the page where they put in a comment....which would almost be better because otherwise you would lose the comment-tracking features if they were just "creating" a thread (FriendFeed, any followers through Disqus).

  • Posted by Vlad Zablotskyy 4 years, 1 month ago

    Daniel,

    Since you are following this thread I though I would jump in with my own request...
    The only reason I did not allow Disqus to manage comments on every single posts on my blog was because it would hide the exiting comments. I would like to see a feature that would import the exiting comments into Disqus unless of course there is away to show existent comments.

  • Posted by J. Phil 4 years, 1 month ago

    I just added your trackback code. Good stuff, thanks!

  • Posted by Shey 4 years ago

    Thanks for the referral!

  • Posted by Shey 4 years ago

    thanks for the tip!

  • Posted by J. Phil 4 years ago

    Glad to be helpful, Shey. Looking forward to seeing Disqus on your blog!

  • Posted by NBC Filter 4 years ago

    Indeed, this article is a great help.

    1. Trackback is a must have
    2. A simple but effective one

  • Posted by [scribkin 4 years ago

    [...] Jangro’s trackback hack to the Disqus [...]

  • Posted by Disqus: 把你的blog评论变成论坛 4 years ago

    [...] [Update]: Disqus目前还不支持对trackback的显示,Jungro在他的文章中提供了一个临时的解决方法: [...]

  • Posted by Why I Intensely Debated But Decided to Disqus 4 years ago

    [...] the straw dropped that broken the camel’s back. This post:
    http://www.jangro.com/a/2008/04/08/hacking-disqus/. The community has started to hack (which in this world is good) Disqus, and if you read the [...]

  • Posted by links for 2008-06-04 | Michael Koby (mkoby.com) 3 years, 11 months ago

    [...] Hacking Disqus | Jangro.com (tags: blogging development comments disqus hacks) Posted in Daily Links | Like this Article? Subscribe var disqusurl = '
    http://www.mkoby.com/2008/06/04/links-for-2008-06-04/ '; var disqus
    title = 'links for 2008-06-04'; var disqus_message = '%0AWant to buy or sell a used BlackBerry? Read this first!!%0A** Posted using Viigo: Mobile RSS, Sports, Current Events and more ** Ever get the feeling that your used BlackBerry is not so fresh? Want to make sure the BlackBerry you’re looking to sell finds a good home without giving away any of your personal [...]%0A'; View the entire comment thread. Subscribe [...]

  • Posted by [scribkin 3 years, 11 months ago

    [...] Disqus announced support for trackbacks on the back-end and javascript plug-in today!  This is great news, as up until now, us Disqus users had to be satisfied with a hack that was whipped up by Scott Jangro. [...]

  • Posted by hack myspace 3 years, 11 months ago

    Trackbacks are great and should be followed. They link together relevant articles and pass the juice that way.

    Posted by Busby 3 years, 4 months ago

    Really great programming skills. And I agree with you dude, Trackbacks are great and should be followed.

  • Posted by sean808080 3 years, 10 months ago

    great stuff here. i bow to your skills.

  • Posted by New Version of Disqus Beta Plugin | Jangro.com 3 years, 10 months ago

    [...] you installed the nofollow Disqus hack that I created a few months ago, you’ll need to reimplement [...]

  • Posted by moserw 3 years, 9 months ago

    Wow. Really great programming skills on display here. Thanks for sharing them. Been looking for something similar for my blog and hopefully it works.

  • Posted by Kaplak Blog » To Disqus or not to Disqus 3 years, 7 months ago

    [...] undecided. All things balanced out, for now we keep Disqus on the blog - even though we might use a temporary hack to enable WordPress trackbacks. In my current estimate the social benefits and effects of using [...]

  • Posted by JMR 3 years, 7 months ago

    Great help! This has the Trackbacks showing up for me. Works as promised. Question: on your main blog page (i.e., not a single post page), where it shows the number of comments, should the number of trackbacks be included in this number also? General blog etiquette question. If yes, how do you get the trackbacks to count as comments on the main index page?

  • Posted by color_chart 3 years, 6 months ago

    Im suprised you havent bought up the duplicate content issues... Disqus stores copies of all blog comments on their site, because they have now main comments on respective blogs indexable surely this is going to result in duplicate content issues with google and the major search engines... what are your views on this? comments are valuable source of keywords but surely if these are displayed on a larger, more popular site such as disqus their value is going to be lost?

  • jangro

    Posted by jangro 3 years, 6 months ago

    "colorchart",

    My blog is pretty well established and gets some decent weight in google, so maybe if I had a newer blog, it could be a little concerning. But even so, I think there's enough difference between what's on the disqus pages and how it is organized and my blog that there isn't really a duplicate content concern for me.

    Let me ask you an SEO question: Do you really get any benefit from commenting around with color
    chart as your username? Really makes me wonder how genuine your comments are.

  • Posted by color_chart 3 years, 6 months ago

    There is a very small seo value but not alot really... I put it there so people know where i come from... as for my comments being genuine then that is something for you to decide...

    As for what you said about duplicate content... Everything ive read in researching the subject says that google (and as far as i know the other majors too) judge duplicate content on a phrase or keyword density basis which means it doesnt really matter where on the page it appears... I may be wrong because im no expert but surely its something worth investigating.

  • jangro

    Posted by jangro 3 years, 6 months ago

    I didn't delete your comment and am talking to you, so clearly it seems to me that your comments are genuine. You're not in very good company with others who stuff their names in comments for SEO purposes.

    I'm happy to have a real person giving real insights no matter what you call yourself.

    The duplicate content thing is certainly worth investigating. I do know that if I search for certain exact phrases that appear in a comment, I may get only my disqus page as that result, not my blog. But, that's my disqus page, and hopefully if that person is interested in what the post was about, they'd come looking.

    So on one hand, there may be duplicate content concerns, and on the other there could be SEO benefits in casting a broader, more powerful net.

    At the end of the day, I can't say that there's been any significant change in search traffic with our without disqus, but I may be wrong in that perception.

  • Posted by SEO Test 3 years, 5 months ago

    Wow what a nice Feature Requests for Disqus with this codes. thanks for this info.

  • Posted by busby_seo_test 3 years, 5 months ago

    Big thanks to this very interesting and helpful post. I suggest that you make more post like this. You are really a big help to us.Thanks a lot. God bless you and more power.....

  • Posted by seotest 3 years, 5 months ago

    oh so this is possible to hack, good for hacker

  • Posted by davis 3 years, 5 months ago

    Indeed , thanks great stuff here .

  • Posted by busbyseotest 3 years, 5 months ago

    thanks for that code

  • Posted by Busby SEO Test 3 years, 4 months ago

    should the number of trackbacks be included in this number also? General blog etiquette question. If yes, how do you get the trackbacks to count as comments on the main index page?

  • Posted by busby seo test 3 years, 4 months ago

    great hack thanks many time

  • Posted by bobby 3 years, 4 months ago

    this article is really really awesome.. and the author is great.. than you a lot

  • Posted by gosip artis terbaru 3 years, 4 months ago

    cool, nice job on hacking disqus. I never thought you could do so much thing with disqus.

  • Posted by inventory 3 years, 3 months ago

    Very good progamming skills. I really impress with those who have programming skills knowledge because with their skill , they can change oren to apple. ;)

  • Posted by Busby seo 3 years, 3 months ago

    @inventory, i agree with you, those people can hack if they have the programming skills knowledge.

  • Posted by Registry Rep 3 years, 3 months ago

    i salute to this programmer your my idol from now on. :D

  • Posted by Suzan 3 years, 2 months ago

    I like this website. This website helped me with prayer learning. Good job. Thank you. Please provide more French prayers. Bye-bye.

  • Posted by steve 3 years, 1 month ago

    Thanks for the code. It will serve its purpose until that feature is added to Disqus proper.

  • Posted by Gman1281 3 years ago

    Cool site, keep up the good work!~The Gman

  • Posted by Gabby 2 years, 11 months ago

    I think Disqus is going to be the next best thing in commenting. It's great at stopping spam!

  • Posted by Term Paper 2 years, 11 months ago

    Excellent features you shared here

  • Posted by hialeah computer pc laptop repair 2 years, 10 months ago

    It sounds like a great application. Technology are actually getting better and better as the time goes..Thanks for sharing this.

  • Posted by busbyseotest 2 years, 6 months ago

    thanks for that code

  • Posted by birkin 2 years, 6 months ago

    Get a notification when there a reply only to your comment

  • Posted by Seo Services 2 years, 6 months ago

    Good features are shared here about disqus.Nofollow and dofollow features are well discussed here.It shows the technology improvement as better than before days.

    http://www.benivolent.com/web_design_company.html" rel="dofollow" rel="nofollow">web design companies


Leave a comment


Comment via Facebook

Listed Under

Reactions

Tags
    This item hasn't been tagged.