different title tags


/ Published in: Ruby
Save to your folder(s)



Copy this code and paste it in your HTML
  1. in my app/views/layout/posts.html.erb
  2.  
  3. <title><%= yield :title %>:: my fisrt rails blog :)</title>
  4.  
  5.  
  6. in my app/views/posts/index.html.erb
  7.  
  8. <% content_for :title do %>
  9. <%= controller.action_name %>
  10. <% end %>
  11.  
  12. and my _post partial
  13.  
  14. <% content_for :title do %>
  15. <%= post.title %>
  16. <% end %>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.