Erik
Erik

Reputation: 4422

How to put a hyperlink in the middle of a paragraph using the slim templating language?

How do you write the following in the slim templating language?

<p>Join the <a href="">Google group</a> and let us know what you think, or what other features you’d like to see.</p>

I tried the following:

p
  ' Join the
  a href="" Google Group
  ' and let us know what you think, or what other features you’d like to see

But that doesn't work because the words 'Group' and 'and' do not have whitespace between them.

Upvotes: 16

Views: 8321

Answers (2)

whatAboutJohn
whatAboutJohn

Reputation: 783

You can do

 p This is a paragraph with a link #{link_to 'embedded', 'http://google.com'}.

Rails tag helpers are just methods, so you can apply that logic to other methods inside views.

Upvotes: 10

Erik
Erik

Reputation: 4422

Apparently you can add extra spaces after the quote:

p
  ' Join the
  a href="" Google Group
  '  and let us know what you think, or what other features you’d like to see

Upvotes: 24

Related Questions