From 705bd74378d568bcb4b9870072a800e45ce22328 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Sun, 13 Feb 2011 18:16:31 -0800 Subject: [PATCH] [#169] Add a ROBOTS meta tag to several forms to hide from web spiders Based on the patch by Yuki Sonoda --- app/helpers/application_helper.rb | 8 ++++++++ app/views/issue_moves/new.rhtml | 3 +++ app/views/issues/edit.rhtml | 3 +++ app/views/issues/new.rhtml | 1 + app/views/wiki/edit.rhtml | 1 + 5 files changed, 16 insertions(+) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c6d88487..b498936d 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -898,6 +898,14 @@ module ApplicationHelper def favicon "" end + + # Add a HTML meta tag to control robots (web spiders) + # + # @param [optional, String] content the content of the ROBOTS tag. + # defaults to no index, follow, and no archive + def robot_exclusion_tag(content="NOINDEX,FOLLOW,NOARCHIVE") + "" + end # Returns true if arg is expected in the API response def include_in_api_response?(arg) diff --git a/app/views/issue_moves/new.rhtml b/app/views/issue_moves/new.rhtml index cd604405..6f2935e1 100644 --- a/app/views/issue_moves/new.rhtml +++ b/app/views/issue_moves/new.rhtml @@ -74,3 +74,6 @@ <%= submit_tag l(:button_move_and_follow), :name => 'follow' %> <% end %> <% end %> +<% content_for :header_tags do %> + <%= robot_exclusion_tag %> +<% end %> diff --git a/app/views/issues/edit.rhtml b/app/views/issues/edit.rhtml index 97f26a20..33267e7e 100644 --- a/app/views/issues/edit.rhtml +++ b/app/views/issues/edit.rhtml @@ -1,3 +1,6 @@

<%=h "#{@issue.tracker.name} ##{@issue.id}" %>

<%= render :partial => 'edit' %> +<% content_for :header_tags do %> + <%= robot_exclusion_tag %> +<% end %> diff --git a/app/views/issues/new.rhtml b/app/views/issues/new.rhtml index 13992382..867590fa 100644 --- a/app/views/issues/new.rhtml +++ b/app/views/issues/new.rhtml @@ -23,4 +23,5 @@ <% content_for :header_tags do %> <%= stylesheet_link_tag 'scm' %> + <%= robot_exclusion_tag %> <% end %> diff --git a/app/views/wiki/edit.rhtml b/app/views/wiki/edit.rhtml index 2615075e..5f47c3f8 100644 --- a/app/views/wiki/edit.rhtml +++ b/app/views/wiki/edit.rhtml @@ -23,6 +23,7 @@ <% content_for :header_tags do %> <%= stylesheet_link_tag 'scm' %> + <%= robot_exclusion_tag %> <% end %> <% html_title @page.pretty_title %>