Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 2 months ago
JSON representation
Rails plugin to add helpers to indicate page titles and meta description.
- Host: GitHub
- URL: https://github.com/sunny/layout_values
- Owner: sunny
- License: mit
- Created: 2013-09-06T12:53:41.000Z (over 11 years ago)
- Default Branch: main
- Last Pushed: 2020-12-26T13:10:35.000Z (almost 4 years ago)
- Last Synced: 2024-10-09T22:18:52.966Z (2 months ago)
- Language: Ruby
- Homepage:
- Size: 29.3 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: MIT-LICENSE
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
```