How to add specific code for all user profile urls - rails app -


i trying sort out metatags rails app. have added tags each of main pages.

there lots of 'user' pages (i.e. each user's profile page) , 'tags' pages (i.e. each tag blog posts has own page).

i want add specific code (basically noindex it) apply 'user' pages, or 'tags' pages.

i can't work out put code or how write it. able apply line of code urls websitename.com/users/..... , websitename.com/tags/.... e.g.

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

is there way this?

you can either in layout or view itself.

the layout conditionally set, this:

#app/views/layouts/application.html.erb <% if controller_name == "users" && action_name == "show" %>    <meta name="robots" content="noindex, follow"> <% end %> 

--

for view, set yield block in layout, , populate view:

#app/views/layouts/application.html.erb <%= yield :robots %>  #app/views/users/show.html.erb <% content_for :robots %>    <meta name="robots" content="noindex, follow"> <% end %> 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -