Last active
December 18, 2015 07:38
-
-
Save mrakowski0/5747691 to your computer and use it in GitHub Desktop.
Ruby helper for I18n meta tags support.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def t_meta(meta) | |
| path = request.path_info.gsub(/^(.*)\//, "") | |
| translation_path = "t.head.#{meta}.#{path} | t.head.#{meta}.#{params[:locale]}" | |
| eval translation_path | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| head: | |
| description: | |
| home: Your index description | |
| offer: Our offer is just great | |
| contact: Contact us immediately | |
| title: | |
| home: Best website in the world! | |
| offer: Our offer is through the roof | |
| contact: Sky's the limit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %head | |
| ... | |
| %meta{:description => "#{t_meta(:description)}"} | |
| ... | |
| %title= t_meta(:title) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment