Tuesday 6 March 2012

Ruby on Rails Page Titles


Accurate page titles are an important part of the SEO for any website. However the architecture of a modern web application relies on the content for each individual page being surrounded by a single layout to help keep the overall layout easy to maintain.

This can have a detrimental effect on SEO as Google (and the others) don’t approve of repetition of page titles as it doesn’t provide helpful information to your users. 

The Rails Approach to Page titles

Let’s setup your app so you can have custom page titles and a fall back title for those you forget.
First in your application.html.erb file (or the page you are using for the layout) add this line of text:

<title><%= content_for?(:title) ? content_for(:title) : "Beo | London based results driven web design & development" %></title>


Here are the standard <title> tags for your website with a dynamic bit of code in-between. The code looks to see if you have a custom title and if not displays the default page title (but remember this is something we are trying to avoid!).  

Next we need to add in the method referenced above, in your application_helper.rb file add this:

def title(page_title)
  content_for(:title) { page_title }
end




Now we need to go to each of our individual pages and insert a line of code, for example on our services.html.erb page we have:



<%- title "Beo | London based results driven web design & development | Services" %>


Again, it’s pretty simple, the code passes the hard coded title to the helper which in turn passes it to the application layout.

Go through each of your pages adding in some custom text for each title.

SEO tips from www.beo.so







30 comments:

  1. well written article but for ror application development professionals they are also very good.

    ReplyDelete
  2. Such a wonderful post. Ruby on Rails Development is one of the most popular application development now-a-days. We are also providing some good tips related to this post.

    Great work.


    Asp.net Development

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. Nice Information Sharing Regarding Installing Ruby on Rails. This is a very good topic to talk thanks for posting this information.

    ROR Development India

    ReplyDelete
  6. Such a great post of your blog. OnGraph Technologies is one of the most popular Ruby on Rails Development Company India. We are also providing some services as Ruby on rails development and Ruby on rails software development.

    ReplyDelete
  7. I Really like your good infomation,Thanks
    and please keep sharing it with us.
    Visit us:
    Website Designing Company London
    Web Development Company London

    ReplyDelete
  8. Thanks for sharing this quality information with us. I really enjoyed reading. juegosjuegos.com | juegos de matar zombies | jogos do friv

    ReplyDelete
  9. This is a great article. It gave me a lot of useful information. thank you very much.
    Signaute:
    Visit to friv than play games2girls and play game kids games online ! have fun!

    ReplyDelete
  10. I also think that the problem will be solved play unblocked games very nice , free unblocked games online to play , descargar whatsapp gratis chat limit , unblocked games , unblocked games , descargar whatsapp gratis

    ReplyDelete
  11. The article you have shared here very awesome. I really like and appreciated your work. I read deeply your article, the points you have mentioned in this article are useful
    Signature:
    facebook entrar iniciar sesion gratis - Sitio Oficial iniciado sesión en Facebook lengua española. facebook entrar rápido, facebook iniciar sesion en tu cuenta de entrar facebook

    ReplyDelete
  12. Thanks for all your information, Website is very nice and informative content.
    Signature:
    download baixar facebook movel, Facebook movel, baixar facebook. Facebook chat, baixar whatsapp, fazer o download baixar whatsapp gratis para Android, iPhone. Últimas Facebook

    ReplyDelete
  13. I would like to thank you for the efforts you have made in writing this article.
    Signature:
    Versión en facebook en español descargar a los países hablan Español: facebook entrar direto agora , facebook en español para and facebook entrar direto

    ReplyDelete
  14. Thanks for sharing the information. It is very useful for my future. keep sharing
    Signature:
    The place to play all unblocked games online. Here you can find every blocked games such as: unblockedgames , unblocked games happy , unblocked games 77 , gmod

    ReplyDelete
  15. Currently every business requires a website to represent itself over the internet. For representing better way you need to use professional web design and development services.
    Web Development Company London | Web Design Companies London

    ReplyDelete
  16. Thanks for all your information, I hope it will be helpful for too many people that are searching for this topic.
    Signature: agario is a multiplayer browser game in which players have to eat competitors or be eaten while striving to dominate the world of colorful cells. In agario game, you start off with a small circle and eat smaller static circles and other smaller players. Once you get big enough you will get addicted. With agar io, you have an option to split your circle in two and throw one half at the other players with larger speed, in order to gain more mass. You have the option to play agar.io in a Free For All mode, where you play against everyone, or you can play in teams. Play agario skins online game for free with your friends now!

    ReplyDelete
  17. Thanks for all your information, I hope it will be helpful for too many people that are searching for this topic Pirate Kings banana kong.

    ReplyDelete
  18. Thanks for all your information, I hope it will be helpful for too many people that are searching for this topic Pirate Kings banana kong.

    ReplyDelete
  19. Thanks a lot for sharing such a nice article. We are working on ROR from last more than 5 years. We offer best price in the industry and complete value of money to clients. We are one of the best companies offering ruby on rails development in India.

    ReplyDelete
  20. First You got a great blog.I will be interested in more similar topics.
    Signature:
    i like play games happy wheels online and play happy wheels 2 games and agario , fireboy watergirl , agar io

    ReplyDelete
  21. Thanks for sharing this information we have experts Ruby on Rails developers in india as well as have knowledge of SEO but we this blog my ideas are cleared more about SEO. For ruby on rails development contact us at: info@cryptextechnologies.com

    ReplyDelete
  22. This comment has been removed by the author.

    ReplyDelete
  23. Cool Runnings Found your site from a friends Facebook link, Heavy Weights | Rookie of the Year it seems that you have growing fanbase and I now understand why Super informative article, thanks a million. Best Action Movies

    ReplyDelete
  24. Great post. If you are looking for developers who work on Ruby on Rails in India, then Cryptex Technologies is the best Ruby on Rails web Development in India. For any queries email us at: info@cryptextextechnologies.com

    ReplyDelete
  25. I realize that nothing is fair but I'm still trying. I just want to do my best and what is possible
    instagram online viewer

    ReplyDelete