In my layout file I have
<head>
<title><%= @title %></title>
</head>
And in my show file:
<% @title = Item.name %>
The problem is that in the page title there is added | Myappname instead of just the Item name
How do I remove the app name in page title?
You should define
@titlein the controller action instead of view. Instead of defining it in show file, you should define it in show method.This is because, the show file is evaluated after rendering the layout application.html.erb, so defining
@titleafterwards in the show view file will not affect the@tiltein the application.html layout.