Ruby on Rails
Monday, May 18, 2015
Rather than setting the <meta name="description" contents="xyzzy"> tag in every webpage of my site, I decided to be clever and set a variable in each controller with the text and
-- do:
<meta name="description" contents=<%= @desc %> />
on the layout instead. The problem is that the generated text has a no quotes:
<meta name="description" contents=FOO BAR/>
is what I end up with.
I've tried every variant of surrounding the text with quotes or using variable interpolation in strings to try to make this work.
Either I end up with no text passed into the layout, or I get
<meta name="description" contents="FOO BAR"/>
Which may actually be correct, but just looks odd.
I've actually decided to add the meta tag the old fashioned way, but now I'm curious as to why I can't make this work.
Any ideas?
Thanks,
Joe
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/dc52e2a0-fee8-4997-910c-3660a6d978bb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment