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
Post a Comment