Skip to content

Instantly share code, notes, and snippets.

@nicolasblanco
nicolasblanco / gist:1069378
Created July 7, 2011 12:07
Rails i18n framework for your meta tags

Rails i18n framework for your meta tags

Here is a convenient method for page titles and other meta tags.

One common solution is to use "yield" and some kind of helpers that would call content_for (like in this Railscasts).

The problem is that for Search Engines Optimization, you should change all your meta tags for every page to avoid duplicate content, and call your helpers on every page...

This workaround uses the i18n framework and tries to find the good tags depending on the page you are, so you don't have to call any helper by default.