Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

such_meta

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

such_meta

  • 0.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
2
Created
Source

SuchMeta

A gem that simplifies SEO meta tags, allowing for customization and internationalization.

Setup & Installation

Add this line to your application's Gemfile:

gem 'such_meta'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install such_meta

Use the built-in generator to set up such_meta.en.yml:

$ bundle exec rails g such_meta:install

The generator will add the such_meta.en.yml file to config/locales/such_meta.en.yml. Use this yml file to set default meta tags for the site and to target specific controller actions. Examples are included below.

Included In This Gem:

There are two basic ways to configure your meta tags:

Get

You can either "get" the meta tag, by passing a tag_type: such_meta(tag_type). If there is a controller/action defined in such_meta.en.yml under specific, the custom tag is returned. Otherwise, the default tags defined under default.

Set

Or, you can "set" the meta tag, by passing the tag_type and the value that you'd like to override: such_meta(tag_type, value).

Setting Up Your Yaml File

Default Meta Tags:

en:
  such_meta:
    default:
      title: 'Default'
      description: 'Default description for Such Meta'
      keywords: 'Default Keyword 1, Default Keyword 2, Default Keyword 3'
      og:
        title: 'Default Facebook Title'
        type: 'Default Facebook Type'
        image: 'Default Image'
      twitter:
        card: 'Default Twitter'
        site: 'Default Site'

Specific Meta Tags

en:
  such_meta:
    default: <!-- please see above -->
    specific:
      controller_name:
        index:
          title: 'Controller Index Title'
          description: 'Description for Controller Index'
          keywords: 'Keyword 1, Keyword 2, Keyword 3'
        show:
          title: 'Controller Show Title'
          description: 'Description for Controller Show'
          keywords:
          og:
            title: 'Facebook'
            type: 'Type'
            url: 'http://www.sampleurl.com'
            image: 'https://image.com/300/400'
          twitter:
            card: 'Twitter'
            site: 'Site'

Here are some recommended meta tags to get you started. These tags belong in application.html.erb in a traditional Rails application:

Title

<title><%= such_meta(:title) %></title>

Description

<meta name="description" content="<%= such_meta(:description) %>">

Keywords

<meta name="keywords" content="<%= such_meta(:keywords) %>">

Facebook

<meta property="og:title" content="<%= such_meta('og.title') %>">

<meta property="og:type" content="<%= such_meta('og.type') %>">

<meta property="og:image" content="<%= such_meta('og.image') %>">

<meta property="og:url" content="<%= such_meta('og.url') %>">

Twitter

<meta property="twitter:card" content="<%= such_meta('twitter.card') %>">

<meta property="twitter:description" content="<%= such_meta('twitter.description') %>">

<meta property="twitter:site" content="<%= such_meta('twitter.site') %>">

<meta property="twitter:title" content="<%= such_meta('twitter.title') %>">

<meta property="twitter:image" content="<%= such_meta('twitter.image') %>">

Contributing

  1. Fork it ( https://github.com/crushlovely/suchmeta/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Running tests

bundle exec guard

FAQs

Package last updated on 20 May 2015

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc