[HOWTO] Make disqus comments do-follow in WordPress

I am using Disqus Comment System v2.61 and it shows comments as nofollow. This is a concern for several WordPress users as their commentators may not be interested to comment if they get no link love via comment url. The disqus comments are later generated by Javascript but it also contains the basic comments for browsers without Javascript. While I have not yet figured out how the Javascript later inserts “nofollow” attribute later when regenerating the comments with Javascript, I have figured out how to remove the ‘rel=”nofollow”‘ from the link of the basic page, which should work for search engine robots. In the version of Disqus Comment System I am using, the comment_author_url() seems to not work. So, I replaced it with get_comment_author_url() and it seems to work. Following is the new comments.php which shows the links as do-follow.

<?php
if (DISQUS_DEBUG) {
	echo "<p><strong>Disqus Debug</strong> thread_id: ".get_post_meta($post->ID, 'dsq_thread_id', true)."</p>";
}
?>
 
<div id="disqus_thread">
	<?php if (!get_option('disqus_disable_ssr')): ?>
		<?php
		// if (is_file(TEMPLATEPATH . '/comments.php')) {
		// 	include(TEMPLATEPATH . '/comments.php');
		// }
		?>
		<div id="dsq-content">
			<ul id="dsq-comments">
	<?php foreach ($comments as $comment) : ?>
				<li id="dsq-comment-<?php echo comment_ID(); ?>">
					<div id="dsq-comment-header-<?php echo comment_ID(); ?>" class="dsq-comment-header">
						<cite id="dsq-cite-<?php echo comment_ID(); ?>">
	<?php if(get_comment_author_url()) : ?>
							<a id="dsq-author-user-<?php echo comment_ID(); ?>" href="<?php echo get_comment_author_url(); ?>" target="_blank"><?php echo comment_author(); ?></a>
	<?php else : ?>
							<span id="dsq-author-user-<?php echo comment_ID(); ?>"><?php echo comment_author(); ?></span>
	<?php endif; ?>
						</cite>
					</div>
					<div id="dsq-comment-body-<?php echo comment_ID(); ?>" class="dsq-comment-body">
						<div id="dsq-comment-message-<?php echo comment_ID(); ?>" class="dsq-comment-message"><?php echo wp_filter_kses(comment_text()); ?></div>
					</div>
				</li>
	<?php endforeach; ?>
			</ul>
		</div>
	<?php endif; ?>
</div>
 
<a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a>
 
<script type="text/javascript">
/* <![CDATA[ */
	var disqus_url = '<?php echo get_permalink(); ?> ';
	var disqus_identifier = '<?php echo dsq_identifier_for_post($post); ?>';
	var disqus_container_id = 'disqus_thread';
	var disqus_domain = '<?php echo DISQUS_DOMAIN; ?>';
	var disqus_shortname = '<?php echo strtolower(get_option('disqus_forum_url')); ?>';
	var disqus_title = <?php echo cf_json_encode(dsq_title_for_post($post)); ?>;
	<?php if (false && get_option('disqus_developer')): ?>
		var disqus_developer = 1;
	<?php endif; ?>
	var disqus_config = function () {
	    var config = this; // Access to the config object
 
	    /* 
	       All currently supported events:
	        * preData — fires just before we request for initial data
	        * preInit - fires after we get initial data but before we load any dependencies
	        * onInit  - fires when all dependencies are resolved but before dtpl template is rendered
	        * afterRender - fires when template is rendered but before we show it
	        * onReady - everything is done
	     */
 
		config.callbacks.preData.push(function() {
			// clear out the container (its filled for SEO/legacy purposes)
			document.getElementById(disqus_container_id).innerHTML = '';
		});
		<?php if (!get_option('disqus_manual_sync')): ?>
		config.callbacks.onReady.push(function() {
			// sync comments in the background so we don't block the page
			DISQUS.request.get('?cf_action=sync_comments&post_id=<?php echo $post->ID; ?>');
		});
		<?php endif; ?>
		<?php
		$sso = dsq_sso();
		if ($sso) {
		    foreach ($sso as $k=>$v) {
		        echo "this.page.{$k} = '{$v}';\n";
		    }
		}
		?>
	};
	var facebookXdReceiverPath = '<?php echo DSQ_PLUGIN_URL . '/xd_receiver.htm' ?>';
/* ]]> */
</script>
 
<script type="text/javascript">
/* <![CDATA[ */
	var DsqLocal = {
		'trackbacks': [
<?php
	$count = 0;
	foreach ($comments as $comment) {
		$comment_type = get_comment_type();
		if ( $comment_type != 'comment' ) {
			if( $count ) { echo ','; }
?>
			{
				'author_name':	<?php echo cf_json_encode(get_comment_author()); ?>,
				'author_url':	<?php echo cf_json_encode(get_comment_author_url()); ?>,
				'date':			<?php echo cf_json_encode(get_comment_date('m/d/Y h:i A')); ?>,
				'excerpt':		<?php echo cf_json_encode(str_replace(array("\r\n", "\n", "\r"), '<br />', get_comment_excerpt())); ?>,
				'type':			<?php echo cf_json_encode($comment_type); ?>
			}
<?php
			$count++;
		}
	}
?>
		],
		'trackback_url': <?php echo cf_json_encode(get_trackback_url()); ?>
	};
/* ]]> */
</script>
 
<script type="text/javascript">
/* <![CDATA[ */
(function() {
	var dsq = document.createElement('script'); dsq.type = 'text/javascript';
	dsq.async = true;
	dsq.src = 'http://' + disqus_shortname + '.' + disqus_domain + '/embed.js?pname=wordpress&pver=<?php echo DISQUS_VERSION; ?>';
	(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
/* ]]> */
</script>

You can replace your current comments.php with this file and have do-follow links for your blog readers. I have implemented it on this blog. Comment here and check the page source of my website to see a dofollow link to your website.

  • Thanks! I was looking for how to do this on my WordPress blog.

    • Thanks for posting this tutorial, I just hope that I can make it work on my site. But it’s strange that you can’t change the javascript to dofollow. Did you have the time to check this out already?

  • wow! Exactly what i was searching for my blog thanks dear!

    • It’s pretty cool, I agree with you. However, I am wondering why it is so difficult to se comments to do-follow? Shouldn’t there be an easier way?

  • Anonymous

    the link is clearly nofollow

    • No it isn’t. If you check the source code (View Source), you can see do-follow links.

      • Mikee

        If you check it by firebug or other web-browser tool you see that it still nofollow. Disqus uses javascript to add it later.

        • Yes, Disqus uses Javascript, but when search engine bots read it, they will see do follow scripts.

          • Mikee

            but isn’t the bots reading javascript?

  • Thanks for that!

  • links still remain nofollow

  • These links are no follow….

  • Anonymous

    I can´t find it on my blog 🙁

  • Great! Exactly what I was looking for, have changed on my own site as well.

  • Great! Exactly what I was looking for, have changed on my own site as well.

  • Very nice! it is very informative

  • javascript is still nofollow as far as I know.

    Del
    http://www.videomarketingtactics.com

  • javasprict stiilll

    hey, how can i get this disqus-google search on my blog ?

  • Its very good information.Disqus comment system is very easy and most widely used comments system .Yes,I agree that it shows no follow list.Its purely javascript based comments.Thanks for sharing your useful information.

  • If DISQUS is no follow what is the point of it?
    I have added this code to my comments.php .

    Thanks for posting

    • If you view source in this page, you can see the following for your comment:

      a id=”dsq-author-user-2812″ href=”http://nealmorgan.co.uk” target=”_blank” onclick=”pageTracker._trackPageview(‘/outgoing/nealmorgan.co.uk?referer=’);”

      It is clearly dofollow as there is no rel=”nofollow” option.

      Googlebot may read Javascript code, but it certainly does not view it like we do in our browsers. So, I’m sure if there is dofollow in the code, it should be dofollow to Googlebot.

      Still, I’ll see if I can do anything about JS code.

  • Hi, is there an easy way to change it to dofollow on blogspot? I just installed disqus on my blog.

  • Hi, thanks for the post. I will give it a try for a friend of mine and see if we can get it to go dofollow!

  • Very nice! thanks

  • I recently switched to Disqus as well and comments are nofollow. I am going to try your tip and post back with results.

  • Please check this out:
    I made the changes to comment.php file and comment posted on the page is showing dofollow.
    http://fixtro.com/blog/growing-your-website-in-5-easy-steps/
    however, if you look at recent comments on right, that link is still showing nofollow. 

    I know you mentioned that you haven’t figured out how you can fix the comment regenration issue with nofollow.  But i simply wanted to share the updates with you.

  • Hmm wonder how we could test whether googie actually sees these as nofollow or not.  theyre looking at more script these days, so it’s hard to tell…
    if this does work, ill need to figure out a .net version of it 😉

  • Thanks for the tip. In my opinion all Comments should be dofollow…blogger want comments but they dont want to give anything back…thats not how it should work

  • You are telling people, how to make do follow and at your own blog you have made comments ‘nofollow’
    What the hell is that?

  • How to check if my blog is DO FOLLOW or NO FOLLOW?
    Can anyone please check?

    • The best way to find out is look for a comment on your blog highlight the name (if it’s a hyperlink) right click and select ‘inspect element’ or ‘view page source’ take a look at the highlighted text and if you find the word ‘nofollow’ then you know its nofollow, and vice versa. 

  • Hi this is yogesh… I have found this information very helpful. Thanks really appreciate this.

  • One of the biggest concerns that people have when they own a website is
    security. There are quite a few different security measures that you can
    take to protect yourself, your site and any information contained
    within the site, but a lot of those measures do have to deal with
    coding. What if you don’t

  • Excellent information i got more information through this post..thanks to sharing

  • Hi,
    I think Disqus is nice comments system, but realisation for wordpress does not support dofollow commentators links.

  • Wow!I really appreciate for your brilliant Efforts on spending time to post this information in a simple and systematic manner.

  • Thanks for sharing.Try to improve this. Its not too good.

  • For those that are just simply seeing rel=”nofollow” in the comment
    links still, you have to load the page with javascript disabled which
    will then remove the nofollow link relationship which should be how a
    search bot views the page too.

    When javascript is enabled, the comments are loading from Disqus’s server which will then apply nofollow to all of the links.

  • Hi,
    I have no doubt on this sweet writing.I  like Disqus so far.I did enjoy seeing how these articles were being rebroadcast via twitter, facebook, etc… 

  • Wow!Keep this well sharing with have a goal feedback.I did enjoy seeing how these articles were being rebroadcast via twitter, facebook, etc…

  • Wow!Keep this well sharing with have a goal feedback.I did enjoy seeing how these articles were being rebroadcast via twitter, facebook, etc…

  • Thanks for the informative blog. The place else may possibly just I get
    that kind of info written in such a excellent approach? I’ve a venture
    that I’m just now operating on, and I’ve been on the glance out for such
    info. 

  • Thanks for the informative blog. The place else may possibly just I get
    that kind of info written in such a excellent approach? I’ve a venture
    that I’m just now operating on, and I’ve been on the glance out for such
    info. 

  • You are telling people, how to make do follow and at your own blog you have made comments ‘nofollow’
    What the hell is that?

  • Thanks for the informative blog. The place else may possibly just I get 
    that kind of info written in such a excellent approach? I’ve a venture 
    that I’m just now operating on, and I’ve been on the glance out for such
    info.

  • Thanks!
    It’s funny you say this because I am in the same boat. I love wordpress as a
    CMS. I’ve been
    looking for a CMS that’s lite but flexible. I’ll have to give disqus a try.
    Thanks for blogging.

  • The whole Disqus system loses a big part of its lure to starting bloggers when everything is nofollow by default. Luckilly methods like these are around, but they should just change it to dofollow by default.

  • Boston Park Plaza Hotel

    Hi, thanks for the publish. I will try it out for a companion and see if we can get it to go dofollow!

  • I had no more idea about it but now I am sure to read this well
    feedback.I think a plugin which identifies and blocks comment and
    trackback spam on blogs with integration to various blogging systems.

  • Why don’t they make it easier? 

  • Hello friend!!
    I enjoyed reading your article and it gives all the information on disqus. Actually, I was not at all aware of this. Thanks for sharing it with us. 

  • webdevelopmentcompanyinusa

    hi, thanks for  sharing this helpful code and information. do follow links are more useful for commenters , it’s really great. I would like to share this information to my friends. 

  • Admiring the time and effort you put into your blog and detailed information you offer! I will bookmark your blog and have my children check up here often. Thumbs up!Keep sharing continue.

  • I think dofollow is deafault from disquss.

  • hi, thanks for sharing. really it’s amazing!

  • Nospam

    Утилизация корабля – http://творческий.рф/фото/11185

  • thanks i was looking for this thanks

  • i am trying to make it dofollow but not working…