<commit_before>= MetaTags

Search Engine Optimization (SEO) plugin for Ruby on Rails applications.

== Download

If you're using Rails 2.1, you can simply use "script/plugin". It will export
all the code from GitHub into "vendor/plugins":

  script/plugin install git://github.com/kpumuk/meta-tags.git

If you are using Rails prior to 2.1, use the following:

  cd vendor/plugins
  git clone git://github.com/kpumuk/meta-tags.git
  rm -rf meta-tags/.git
  cd ../..  

To continuously track meta-tags development, it's probably best to install it
as a plugin using some vendor branch management tool like Braid:

  gem install evilchelu-braid

Using Braid to add a Rails plugin is simple:

  # (make sure you've commited everything first)
  braid add -p git://github.com/kpumuk/meta-tags.git
  
  # now you should have the library in vendor/plugins/meta-tags

== Titles

Page titles are very important for Search engines. The titles in the
browser are displayed in the title bar. The search engines would look at
the this title bar to determine what the page is all about.

  <title>Some Page Title</title>
  <title>Page Title | Site Title</title>

Recommended title tag length: up to <b>70 characters</b>, <b>10 words</b>.

== Description

Description tags are called meta tags as they are not displayed by the
browsers as that of titles. But these descriptions may be displayed by
some search engines. They are used to describe the contents of a page in
2 or 3 sentences.

  <meta name="description" content="All text about keywords, other keywords" />

Recommended description tag length: up to <b>160 characters</b>.

== Keywords

Meta keywords tag are used to place your keywords that you think a
surfer would search in Search engines. Repeating keywords unnecessarily
would be considered spam and you may get permanently banned from SERP's

  <meta name="keywords" content="keyword1, keyword2, keyword3" />

Recommended keywords tag length: up to <b>255 characters</b>, <b>20 words</b>.

== Noindex

By using the noindex meta tag, you can signal to search engines to not 
include specific pages in their indexes.

  <meta name="robots" content="noindex">
  <meta name="googlebot" content="noindex">

This is useful for pages like login, password reset, privacy policy, etc.  

Further reading:
* Blocking Google http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=93708
* Using meta tags to block access to your site http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=93710

== MetaTags Usage

First, add this code to your main layout:

  <head>
    <%= display_meta_tags :site => 'My website' %>
  </head>

Then, to set the page title, add this to each of your views (see below for other options):

  <h1><%= title 'My page title' %></h1>

When views are rendered, the page title will be included in the right spots:

  <head>
    <title>My website | My page title</title>
  </head>
  <body>
    <h1>My page title</h1>
  </body>

You can find allowed options for +display_meta_tags+ method below.

=== Using MetaTags in controller

You can define following instance variables:

  @page_title = 'Member Login'
  @page_description = 'Member login page.'
  @page_keywords = 'Site, Login, Members'
  
Also you could use +set_meta_tags+ method to define all meta tags simultaneously:
  
  set_meta_tags :title => 'Member Login',
                :description => 'Member login page.',
                :keywords => 'Site, Login, Members'

You can find allowed options for +set_meta_tags+ method below.

=== Using MetaTags in view

To set meta tags you can use following methods:

  <% title 'Member Login' %>
  <% description 'Member login page.' %>
  <% keywords 'Member login page.' %>

Also there is +set_meta_tags+ method exists:

  <% set_meta_tags :title => 'Member Login',
                   :description => 'Member login page.',
                   :keywords => 'Site, Login, Members' %>

The +title+ methods returns title itself, so you can use it to show the title
somewhere on the page:

  <h1><%= title 'Member Login' %></h1>

If you want to set the title and display another text, use this:

  <h1><%= title 'Member Login', 'Here you can login to the site:' %></h1>

=== Allowed options for +display_meta_tags+ and +set_meta_tags+ methods

Use these options to customize the title format:

* <tt>:site</tt> -- site title;
* <tt>:title</tt> -- page title;
* <tt>:description</tt> -- page description;
* <tt>:keywords</tt> -- page keywords;
* <tt>:prefix</tt> -- text between site name and separator;
* <tt>:separator</tt> -- text used to separate website name from page title;
* <tt>:suffix</tt> -- text between separator and page title;
* <tt>:lowercase</tt> -- when true, the page name will be lowercase;
* <tt>:reverse</tt> -- when true, the page and site names will be reversed.
* <tt>:noindex</tt> -- when true, 'robots' will be used, otherwise the string will be used

And here are a few examples to give you ideas.

  <%= title :separator => "&mdash;" %>
  <%= title :prefix => false, :separator => ":" %>
  <%= title :lowercase => true %>
  <%= title :reverse => true, :prefix => false %>

=== Allowed values

You can specify +title+ as a string or array:

  set_meta_tags :title => ['part1', 'part2'], :site => 'site'
  # site | part1 | part2
  set_meta_tags :title => ['part1', 'part2'], :reverse => true, :site => 'site'
  # part2 | part1 | site

Keywords can be passed as string of comma-separated values, or as an array:

  set_meta_tags :keywords => ['tag1', 'tag2']
  # tag1, tag2

Description is a string (HTML will be stripped from output string).

== Alternatives

There are several plugins influenced me to create this one:

* Headliner: http://github.com/mokolabs/headliner
* meta_on_rals: http://github.com/ashchan/meta_on_rails

== Credits

<NAME> (author) <<EMAIL>> http://kpumuk.info
<NAME> (contributor) <<EMAIL>> http://roderick.dk<commit_msg>Updated RDoc with noindex description<commit_after>= MetaTags

Search Engine Optimization (SEO) plugin for Ruby on Rails applications.

== Download

If you're using Rails 2.1, you can simply use "script/plugin". It will export
all the code from GitHub into "vendor/plugins":

  script/plugin install git://github.com/kpumuk/meta-tags.git

If you are using Rails prior to 2.1, use the following:

  cd vendor/plugins
  git clone git://github.com/kpumuk/meta-tags.git
  rm -rf meta-tags/.git
  cd ../..  

To continuously track meta-tags development, it's probably best to install it
as a plugin using some vendor branch management tool like Braid:

  gem install evilchelu-braid

Using Braid to add a Rails plugin is simple:

  # (make sure you've commited everything first)
  braid add -p git://github.com/kpumuk/meta-tags.git
  
  # now you should have the library in vendor/plugins/meta-tags

== Titles

Page titles are very important for Search engines. The titles in the
browser are displayed in the title bar. The search engines would look at
the this title bar to determine what the page is all about.

  <title>Some Page Title</title>
  <title>Page Title | Site Title</title>

Recommended title tag length: up to <b>70 characters</b>, <b>10 words</b>.

== Description

Description tags are called meta tags as they are not displayed by the
browsers as that of titles. But these descriptions may be displayed by
some search engines. They are used to describe the contents of a page in
2 or 3 sentences.

  <meta name="description" content="All text about keywords, other keywords" />

Recommended description tag length: up to <b>160 characters</b>.

== Keywords

Meta keywords tag are used to place your keywords that you think a
surfer would search in Search engines. Repeating keywords unnecessarily
would be considered spam and you may get permanently banned from SERP's

  <meta name="keywords" content="keyword1, keyword2, keyword3" />

Recommended keywords tag length: up to <b>255 characters</b>, <b>20 words</b>.

== Noindex

By using the noindex meta tag, you can signal to search engines to not 
include specific pages in their indexes.

  <meta name="robots" content="noindex">
  <meta name="googlebot" content="noindex">

This is useful for pages like login, password reset, privacy policy, etc.  

Further reading:
* Blocking Google http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=93708
* Using meta tags to block access to your site http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=93710

== MetaTags Usage

First, add this code to your main layout:

  <head>
    <%= display_meta_tags :site => 'My website' %>
  </head>

Then, to set the page title, add this to each of your views (see below for other options):

  <h1><%= title 'My page title' %></h1>

When views are rendered, the page title will be included in the right spots:

  <head>
    <title>My website | My page title</title>
  </head>
  <body>
    <h1>My page title</h1>
  </body>

You can find allowed options for +display_meta_tags+ method below.

=== Using MetaTags in controller

You can define following instance variables:

  @page_title = 'Member Login'
  @page_description = 'Member login page.'
  @page_keywords = 'Site, Login, Members'
  
Also you could use +set_meta_tags+ method to define all meta tags simultaneously:
  
  set_meta_tags :title => 'Member Login',
                :description => 'Member login page.',
                :keywords => 'Site, Login, Members'

You can find allowed options for +set_meta_tags+ method below.

=== Using MetaTags in view

To set meta tags you can use following methods:

  <% title 'Member Login' %>
  <% description 'Member login page.' %>
  <% keywords 'Member login page.' %>

Also there is +set_meta_tags+ method exists:

  <% set_meta_tags :title => 'Member Login',
                   :description => 'Member login page.',
                   :keywords => 'Site, Login, Members' %>

The +title+ methods returns title itself, so you can use it to show the title
somewhere on the page:

  <h1><%= title 'Member Login' %></h1>

If you want to set the title and display another text, use this:

  <h1><%= title 'Member Login', 'Here you can login to the site:' %></h1>

=== Allowed options for +display_meta_tags+ and +set_meta_tags+ methods

Use these options to customize the title format:

* <tt>:site</tt> -- site title;
* <tt>:title</tt> -- page title;
* <tt>:description</tt> -- page description;
* <tt>:keywords</tt> -- page keywords;
* <tt>:prefix</tt> -- text between site name and separator;
* <tt>:separator</tt> -- text used to separate website name from page title;
* <tt>:suffix</tt> -- text between separator and page title;
* <tt>:lowercase</tt> -- when true, the page name will be lowercase;
* <tt>:reverse</tt> -- when true, the page and site names will be reversed.
* <tt>:noindex</tt> -- when true, 'robots' will be used, otherwise the string will be used

And here are a few examples to give you ideas.

  <%= title :separator => "&mdash;" %>
  <%= title :prefix => false, :separator => ":" %>
  <%= title :lowercase => true %>
  <%= title :reverse => true, :prefix => false %>

=== Allowed values

You can specify +title+ as a string or array:

  set_meta_tags :title => ['part1', 'part2'], :site => 'site'
  # site | part1 | part2
  set_meta_tags :title => ['part1', 'part2'], :reverse => true, :site => 'site'
  # part2 | part1 | site

Keywords can be passed as string of comma-separated values, or as an array:

  set_meta_tags :keywords => ['tag1', 'tag2']
  # tag1, tag2

Description is a string (HTML will be stripped from output string).

== Alternatives

There are several plugins influenced me to create this one:

* Headliner: http://github.com/mokolabs/headliner
* meta_on_rals: http://github.com/ashchan/meta_on_rails

== Credits

* <NAME> (author) <<EMAIL>> http://kpumuk.info
* <NAME> (contributor) <<EMAIL>> http://roderick.dk
{'fraction_non_alphanumeric': 0.11341772151898734, 'fraction_numerical': 0.008607594936708861, 'mean_word_length': 3.83122706889523, 'pattern_counts': {'":': 4, '<': 147, '<?xml version=': 0, '>': 185, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2424012', 'n_tokens_mistral': 3679, 'n_tokens_neox': 3462, 'n_words': 1485}