Socket
Book a DemoInstallSign in
Socket

layout_values

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

layout_values

1.0.0
bundlerRubygems
Version published
Maintainers
1
Created
Source

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

FAQs

Package last updated on 26 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.