kpumuk / meta-tags

Search Engine Optimization (SEO) for Ruby on Rails applications.
MIT License
2.73k stars 275 forks source link

noindex tags are rendered incorrectly #195

Closed rnitta closed 5 years ago

rnitta commented 5 years ago
<% set_meta_tags noindex: 'robots', nofollow: 'googlebot' %>
<%= display_meta_tags%>

and it's expected output will be

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

but now actually the output is

<meta name="robots" content="noindex, nofollow">

with more research, I found this causes only if noindex name is 'robots' or anything other than String object. so then,

<% set_meta_tags noindex: 'googlebot', nofollow: 'hogehoge' %>
<%= display_meta_tags%>

doesn't matter:

<meta name="googlebot" content="noindex">
<meta name="hogehoge" content="nofollow">

I think this is a bug of these code: https://github.com/kpumuk/meta-tags/blob/c3addee0c5f7e047ff79d13f7f6282e8500f9ce2/lib/meta_tags/meta_tags_collection.rb#L145-L152 https://github.com/kpumuk/meta-tags/blob/c3addee0c5f7e047ff79d13f7f6282e8500f9ce2/lib/meta_tags/meta_tags_collection.rb#L198-L204

especially in https://github.com/kpumuk/meta-tags/blob/c3addee0c5f7e047ff79d13f7f6282e8500f9ce2/lib/meta_tags/meta_tags_collection.rb#L200

kpumuk commented 5 years ago

Thank you for the report, the issue should be resolved in master, and in the version 2.12.0 when it is released.