# Different titles

**URL:** <https://www.ruby-forum.com/t/different-titles/173640>\
**Category:** Rails\
**Created:** [August 12, 2009, 3:55pm UTC](https://www.ruby-forum.com/t/different-titles/173640 "2009-08-12T15:55:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![webstic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/58f4c7/32.png) [@webstic](https://www.ruby-forum.com/u/webstic)\
**Post date:** [August 12, 2009, 3:55pm UTC](https://www.ruby-forum.com/t/different-titles/173640/1 "2009-08-12T15:55:31Z")

</div>

hi!

I want to have different titles in my weblog.

in my app/views/layout/post.html.erb

i have this in head: \<%= controller.action\_name %\> :: webstic  
blog 🙂

thats fine if im in page that listing my blog articles!

but if i chooce to view a page i want the title.post in my

how i can do that?

thanks

philip.g

---

<div class="post-metadata">

**Author:** ![webstic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/58f4c7/32.png) [@webstic](https://www.ruby-forum.com/u/webstic)\
**Post date:** [August 12, 2009, 4:06pm UTC](https://www.ruby-forum.com/t/different-titles/173640/2 "2009-08-12T16:06:17Z")

</div>

Philip G. wrote:

> hi!
> 
> I want to have different titles in my weblog.
> 
> in my app/views/layout/post.html.erb
> 
> i have this in head: \<%= controller.action\_name %\> :: webstic  
> blog 🙂
> 
> thats fine if im in page that listing my blog articles!
> 
> but if i chooce to view a page i want the title.post in my
> 
> how i can do that?
> 
> thanks
> 
> philip.g

i found it! sorry for the rush post!

i could help im writing what i’ve did:

in my app/views/layout/posts.html.erb

\<%= yield :title %\>:: my fisrt rails blog :)

in my app/views/posts/index.html.erb

\<% content\_for :title do %\>  
\<%= controller.action\_name %\>  
\<% end %\>

and my \_post partial

\<% content\_for :title do %\>  
\<%= post.title %\>  
\<% end %\>

this works for me 🙂

---

<div class="post-metadata">

**Author:** ![webstic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/58f4c7/32.png) [@webstic](https://www.ruby-forum.com/u/webstic)\
**Post date:** [August 14, 2009, 2:54am UTC](https://www.ruby-forum.com/t/different-titles/173640/3 "2009-08-14T02:54:22Z")

</div>

On Aug 12, 2009, at 4:06 PM, Philip G. wrote:

> CUT

There’s even a better solution, search the API for content\_for.

ngw

---

<div class="post-metadata">

**Author:** ![webstic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/58f4c7/32.png) [@webstic](https://www.ruby-forum.com/u/webstic)\
**Post date:** [August 14, 2009, 3:03am UTC](https://www.ruby-forum.com/t/different-titles/173640/4 "2009-08-14T03:03:53Z")

</div>

Nicholas W. wrote:

> On Aug 12, 2009, at 4:06 PM, Philip G. wrote:
> 
> > CUT
> 
> There’s even a better solution, search the API for content\_for.
> 
> ngw

Um, isn’t that what he used?

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![webstic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/58f4c7/32.png) [@webstic](https://www.ruby-forum.com/u/webstic)\
**Post date:** [August 14, 2009, 6:21am UTC](https://www.ruby-forum.com/t/different-titles/173640/5 "2009-08-14T06:21:33Z")

</div>

Hi there,

Taking this a little step further, this is the pattern that our team  
has been using.

[http://www.robbyonrails.com/articles/2008/03/26/managing-seo-friendly-html-titles-with-rails](http://www.robbyonrails.com/articles/2008/03/26/managing-seo-friendly-html-titles-with-rails)

Good luck!

Robby

On Wed, Aug 12, 2009 at 7:06 AM, Philip  
Gavrilos[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > blog 🙂
> 
> \<% end %\>
> 
> this works for me 🙂
> 
> –  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> >

–  
Robby R.  
Chief Evangelist, Partner

PLANET ARGON, LLC  
design // development // hosting w/Ruby on Rails

> **[Planet Argon](https://www.planetargon.com/)**
>
> Planet Argon is a Ruby on Rails development agency specializing in maintenance and support for existing Rails apps. Based in Portland, OR, Planet Argon has been a member of the Rails community since 2004.

[http://robbyonrails.com/](http://robbyonrails.com/)  
[http://twitter.com/planetargon](http://twitter.com/planetargon)  
aim: planetargon

+1 503 445 2457  
+1 877 55 ARGON [toll free]  
+1 815 642 4068 [fax]

---

<div class="post-metadata">

**Author:** ![webstic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/58f4c7/32.png) [@webstic](https://www.ruby-forum.com/u/webstic)\
**Post date:** [August 14, 2009, 1:39pm UTC](https://www.ruby-forum.com/t/different-titles/173640/6 "2009-08-14T13:39:57Z")

</div>

On Aug 14, 2009, at 3:03 AM, Marnen Laibow-Koser wrote:

> Nicholas W. wrote:
> 
> > On Aug 12, 2009, at 4:06 PM, Philip G. wrote:
> > 
> > > CUT
> > 
> > There’s even a better solution, search the API for content\_for.
> 
> Um, isn’t that what he used?

I need to put more attention when I read 🙂  
My bad.

ngw
