https://github.com/phawk/social_meta_tags
https://github.com/phawk/social_meta_tags
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/phawk/social_meta_tags
- Owner: phawk
- License: mit
- Created: 2015-07-01T21:34:50.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2023-01-20T03:07:50.000Z (about 3 years ago)
- Last Synced: 2025-06-11T23:48:14.060Z (10 months ago)
- Language: Ruby
- Size: 59.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 13
-
Metadata Files:
- Readme: readme.md
- License: MIT-LICENSE
Awesome Lists containing this project
README
# Social meta tags
[](https://travis-ci.org/phawk/social_meta_tags)
Easily add [Open graph](https://developers.facebook.com/docs/sharing/webmasters#markup) and [Twitter card](https://dev.twitter.com/cards/markup) `` tags to your Rails 4 application.
## Installation
Add the following to your gemfile and bundle install
```rb
gem 'social_meta_tags'
```
## Configuration
Create `config/initializers/social_meta_tags.rb` and setup your site name
```rb
SocialMetaTags::Options.site_name = "My Site"
```
Add the `<%= social_meta_tags %>` to your `app/views/layouts/application.html.erb`, something like:
```html
My App
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
<%= social_meta_tags %>
...
```
## Basic Usage
In your view files you will have access to the **social_meta_info** helper
```html
<% social_meta_info(
title: "This pages title",
description: "A description of the page"
) %>
```
## Full Usage
In your view files you will have access to the **social_meta_info** helper
```html
<% social_meta_info(
title: "This pages title",
description: "A description of the page",
og: {
title: "This pages title",
description: "A description of the page"
},
twitter: {
title: "This pages title",
description: "A description of the page"
}
) %>
```