From: Tom Hughes Date: Sun, 20 Dec 2015 00:19:16 +0000 (+0000) Subject: Add rel=nofollow to links to tagless nodes in browse pages X-Git-Tag: live~4655 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/18b8fc60bb08b2df03fa74537ea51cdd7fcfd39a?ds=inline;hp=--cc Add rel=nofollow to links to tagless nodes in browse pages --- 18b8fc60bb08b2df03fa74537ea51cdd7fcfd39a diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 287fcd9f9..b317054b6 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -85,7 +85,7 @@ Metrics/MethodLength: # Offense count: 1 # Configuration parameters: CountComments. Metrics/ModuleLength: - Max: 126 + Max: 129 # Offense count: 4 # Configuration parameters: CountKeywordArgs. diff --git a/app/helpers/browse_helper.rb b/app/helpers/browse_helper.rb index 3723186b8..6c9e108dc 100644 --- a/app/helpers/browse_helper.rb +++ b/app/helpers/browse_helper.rb @@ -52,6 +52,10 @@ module BrowseHelper end end + def link_follow(object) + "nofollow" if object.tags.empty? + end + def format_key(key) if url = wiki_link("key", key) link_to h(key), url, :title => t("browse.tag_details.wiki_link.key", :key => key) diff --git a/app/views/browse/_relation_member.html.erb b/app/views/browse/_relation_member.html.erb index 0d17de349..87b7e301b 100644 --- a/app/views/browse/_relation_member.html.erb +++ b/app/views/browse/_relation_member.html.erb @@ -1,6 +1,6 @@ <% member_class = link_class(relation_member.member_type.downcase, relation_member.member) - linked_name = link_to printable_name(relation_member.member), { :action => relation_member.member_type.downcase, :id => relation_member.member_id.to_s }, :title => link_title(relation_member.member) + linked_name = link_to printable_name(relation_member.member), { :action => relation_member.member_type.downcase, :id => relation_member.member_id.to_s }, :title => link_title(relation_member.member), :rel => link_follow(relation_member.member) type_str = t'browse.relation_member.type.' + relation_member.member_type.downcase %>
  • <%= diff --git a/app/views/browse/_way.html.erb b/app/views/browse/_way.html.erb index b1dffb9ef..489b9cf07 100644 --- a/app/views/browse/_way.html.erb +++ b/app/views/browse/_way.html.erb @@ -15,7 +15,7 @@