Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

noindex tags are rendered incorrectly #195

Closed
rnitta opened this issue Mar 28, 2019 · 1 comment · Fixed by #201
Closed

noindex tags are rendered incorrectly #195

rnitta opened this issue Mar 28, 2019 · 1 comment · Fixed by #201

Comments

@rnitta
Copy link

rnitta commented Mar 28, 2019

<% 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:

def extract_noindex
noindex_name, noindex_value = extract_noindex_attribute(:noindex)
index_name, index_value = extract_noindex_attribute(:index)
nofollow_name, nofollow_value = extract_noindex_attribute(:nofollow)
follow_name, follow_value = extract_noindex_attribute(:follow)
noindex_attributes = if noindex_name == follow_name && (noindex_value || follow_value)

def extract_noindex_attribute(name)
noindex = extract(name)
noindex_name = noindex.kind_of?(String) ? noindex : 'robots'
noindex_value = noindex ? name.to_s : nil
[ noindex_name, noindex_value ]
end

especially in

noindex_name = noindex.kind_of?(String) ? noindex : 'robots'

@kpumuk
Copy link
Owner

kpumuk commented Sep 10, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants