Project

bad_bot

0.0
No commit activity in last 3 years
No release in over 3 years
Avoid bad keywords from being indexed by google and other robots.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 3.2.3
 Project Readme

BadBot¶ ↑

<img src=“https://secure.travis-ci.org/tscolari/bad_bot.png” />

This gem simply gives you the ability to avoid certain pieces of your view from being indexed by search bots.

Even if this is generally not recommended, there are situations that you really don’t want parts to be indexed. Instead of loading all this stuff from a javascript, BadBot simply gives you an option for doing this instead:

<%= no_bot do %>
  stuff i dont wat to be indexed
<% end %>

in case of a search bot request, the content of the block won’t be rendered.

Configuration¶ ↑

Include the gem in your gemfile: ‘gem ’bad_bot’‘. And load it in a controller, for example `ApplicationController`:

class ApplicationController < ActionController::Base
  include BadBot::Detector
end

Usage¶ ↑

Once your controller is configured, you can call on you views/controller the ‘no_bot` and `is_bot?` methods:

Stories
<% no_bot do %>
  1 of 10 pages
<% end %>
...

Stories
<% unless is_bot? %>
  1 of 10 pages
<% end %>

Customization¶ ↑

By default it will only trigger for Google, Yahoo and Bing.

You can add new user-agents to the robots list by using the ‘BadBot::Bots.setup` method.

# some_initializer.rb
BadBot::Bots.instance.setup do |robots|
  robots << 'otherbot'
  robots << 'otherbot2'
end

Caution¶ ↑

How you will use this is entirely up to you. You can get punished by search engines if you make bad use of it. My intent on creating this was to remove some useless words that kept showing as the highest keywords at webmastertools.