You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Metamagic is a simple [Ruby on Rails](http://rubyonrails.org) plugin for creating meta tags.
9
+
It supports regular meta tags, [OpenGraph](http://ogp.me/) (Facebook), [Twitter Cards](https://dev.twitter.com/docs/cards/types/summary-card), and custom tags.
10
+
11
+
See the [changelog](https://github.com/lassebunk/metamagic/blob/master/CHANGELOG.md) for changes in version 3.0.
7
12
8
13
Installation
9
14
------------
10
15
11
16
In your *Gemfile*:
12
17
13
18
```ruby
14
-
gem 'metamagic'
19
+
gem 'metamagic', '3.0.0.beta2'
15
20
```
16
21
17
22
Then run `bundle install`.
@@ -34,30 +39,55 @@ Then, at the top of your view, e.g. *app/views/posts/show.html.erb*:
**Note:** Shortcut helpers will never override methods already present in the view context, so for example if you have a method named `title`, this will not be overridden.
83
+
54
84
### Specifying default meta tag values
55
85
56
86
It's possible to specify default values to be shown if a view doesn't specify its own values. In your *app/views/layouts/application.html.erb*:
57
87
58
88
```erb
59
89
<head>
60
-
<%= metamagic :title => "My default title", :description => "My default description.", :keywords => %w(keyword1 keyword2 keyword3) %>
90
+
<%= metamagic title: "My default title", description: "My default description.", keywords: %w(keyword1 keyword2 keyword3) %>
61
91
...
62
92
</head>
63
93
```
@@ -66,11 +96,11 @@ These values are then inserted if a view doesn't set others.
66
96
67
97
### Custom meta tags
68
98
69
-
For custom meta tags, just call it like this in the top of your view:
99
+
For custom meta tags, you can use it like this:
70
100
71
101
```erb
72
102
<%
73
-
meta :my_custom_tag => "My custom value"
103
+
meta my_custom_name: "My custom value"
74
104
%>
75
105
```
76
106
@@ -79,18 +109,20 @@ This will generate the following:
0 commit comments