Gibson
Gibson

Reputation: 2085

Using meta tags gem, how to render metas in content_for?

I'm having problems with this Gem, when using content for.

In my application.html.erb, I have the following:

<head>
      <% if current_page?(root_path) %>
        <meta name="description" content="My page">
      <% else %>
        <%= yield :description_meta %>
      <% end %>
</head>

And then, in my views, I do the following:

<% content_for :description_meta do %>
        <% set_meta_tags :description => "My description" %>
<% end %>

It wont paint any metas, and if I render it with <%=, it will show in the body of the page as normal text.

Any ideas? Thanks

Upvotes: 0

Views: 382

Answers (1)

Maxim
Maxim

Reputation: 9961

Read MetaTags Usage.

Seems like set_meta_tags just configure meta tags and display_meta_tags render them.

Upvotes: 2

Related Questions