0.0
No commit activity in last 3 years
No release in over 3 years
Add helpers to indicate page titles and meta description.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

>= 4.1.11
 Project Readme

LayoutValues

Rails plugin to add helpers to indicate page titles and meta description.

Usage

In your layout:

<title><%= title %></title>
<meta name="description" content="<%= meta_description %>" />

In your views:

<% title "Best Page Ever" %>
<% meta_description "The best page ever on the internets" %>

Or even:

<h1><%= title "Best Page Ever" %></h1>

You can use translation files to customize the title:

en:
  layout:
    title:
      format: "%{title} — My Site"
      default: "My Site"
    meta_description:
      format: "%{meta_description}, via My Site"
      default: "My description"
    meta_keywords:
      format: "%{meta_keywords}"
      default: "mysite"

You can also set titles in your translation files directly by controller and action:

fr:
  users:
    show:
      title: "Mon compte"
      meta_description: "Éditer mon compte"

Requirements

Rails 4, Ruby 2.

Install

Add these lines to your Gemfile:

# Helpers for page title and meta description.
gem "layout_values"

Install it:

$ bundle

Then in app/helpers/application_helper.rb, add:

module ApplicationHelper
  include LayoutValuesHelper
end