This problem is not critical… but would be helpful for me to know the answer. I’ve been using Ryan Bates’ method of putting titles on pages. BTW, he’s a great innovator and contributor to the rails community, isn’t he?
application_helper file:
def title(page_title)
content_for(:title) { page_title }
end
layout file:
<head>
<title>foo.com - <%= yield(:title) %></title>
...
</head>
<body>
...
<h1 class="heading"><%= yield(:title) %></h1>
I am trying to manipulate the title to insert more spaces and make one of the words italicized. I thought that if i put the title together as a variable I might be able to do it. I tried inserting and that doesn’t work. I tried inserting html <i></i> and that doesn’t work. I would like to get it to look like this:
First Second Third
How do I change the code below to make the title look like that?
<% ttl = "First Second Third" %>
<% title ttl %>
Thanks for your help.
By HTML syntax, the
titleelement content must be plain text, and browsers actually enforce this: the content is rendered as-is, without interpreting anything as HTML tags.You can have no-break spaces there, but you may need to enter them directly as characters (U+00A0).
You cannot have
<i>tags there, no matter what technique you use to generate thetitleelement.