0

I have an issue on a site I maintain where we use the Solspace Rating module. We have added up/down vote links on ratings and are triggering the click with a JavaScript event, however Google (and other search engine bots) appear to be crawling the target URLs and as a result generating thousands of up/down votes during the crawl.

We have tried adding rel="nofollow" and removing the URL from the href and placing it inside a custom data attribute instead but still no joy...

Our markup:

{exp:rating:rating_vote_stats rating_id="{rating_id}"}
<a href="#" class="vote" rel="nofollow" data-vote-path="{path='reviews/vote'}/{rating_id}/up">Yes</a>
<a href="#" class="vote" rel="nofollow" data-vote-path="{path='reviews/vote'}/{rating_id}/down">No</a>
{/exp:rating:rating_vote_stats}

and our JavaScript/jQuery:

$(".vote") .click (function(e) {
    e.preventDefault();
    var link = $(this).data("vote-path");
    $.ajax({
        url: link
    });
});

Any suggestions as to how we can resolve this issue without requiring log-in to up/down vote?

4
  • 1
    Have you tried adding some disallow rules to your robots.txt to prevent indexing of /reviews/vote ? Apr 16 '16 at 1:34
  • Does disallow actually stop Google from hitting the URL though, I think that it perhaps prevents indexing but does not prevent it from actually being crawled. Apr 18 '16 at 8:06
  • @Bluedreamer is correct. robots.txt prevents it from being crawled. <meta name="robots" content="noindex"> prevents it from being indexed.
    – AllInOne
    Apr 19 '16 at 14:02
  • Nope, robots.txt can prevent a URL from being indexed but it won't prevent it from being crawled. That's my issue. :) May 19 '16 at 9:01
0

Ok, working this out in the end. I used a relatively simple .htaccess rule to prevent access to the voting URLs by common robots:

# Prevent Robots from voting on reviews
RewriteCond %{HTTP_USER_AGENT} (googlebot|bingbot|Baiduspider) [NC]
RewriteRule ^reviews/course/(.*)/review/vote/(.*)/(.*)$ - [R=403,L]

That does it! :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.