Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sunny/layout_values

Rails plugin to add helpers to indicate page titles and meta description.
https://github.com/sunny/layout_values

Last synced: about 17 hours ago
JSON representation

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

Awesome Lists containing this project

README

        

# LayoutValues

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

Usage
-----

In your layout:

```erb
<%= title %>

```

In your views:

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

Or even:

```erb

<%= title "Best Page Ever" %>


```

You can use translation files to customize the title:

```yml
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:

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

Requirements
------------

Rails 4, Ruby 2.

Install
-------

Add these lines to your Gemfile:

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

Install it:

```sh
$ bundle
```

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

```rb
module ApplicationHelper
include LayoutValuesHelper
end
```