donkey
donkey

Reputation: 4363

How to set a specific title to a HAML page

I want to set the name for my index page to "Your studio".

I used this:

%head
    %title ABCDE
%body
    blablablabla...

It did not appear to work. Please help to solve this simple question.

Upvotes: 3

Views: 2232

Answers (1)

siekfried
siekfried

Reputation: 2964

In your layout, you can use:

%head
  %title= yield(:title)

And in your view:

= content_for(:title, "ABCDE")

Without repeating the head and title tags. Also you should only use the bodytag in the layout.

Upvotes: 4

Related Questions