metatags 0.1 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/metatags/version.rb +1 -1
- data/readme.markdown +45 -0
- metadata +5 -5
data/lib/metatags/version.rb
CHANGED
data/readme.markdown
CHANGED
@@ -0,0 +1,45 @@
|
|
1
|
+
# Metatags
|
2
|
+
|
3
|
+
I wrote this out of annoyance at all the other metatag generation gems there are out there. They all, or all that I could find, either mess the attributes you're providing or limit the tags that you can create. What the hell? I just want to create some open graph tags.
|
4
|
+
|
5
|
+
Use add_meta and pass a hash of whatever attributes you want the metatag to have. The attributes are passed to Rails' tag helper to generate the meta tag. Simples.
|
6
|
+
|
7
|
+
In your Gemfile...
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'metatags'
|
11
|
+
```
|
12
|
+
|
13
|
+
In your controller...
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
add_meta :property => 'og:title', :content => 'Lorem Ipsum'
|
17
|
+
```
|
18
|
+
|
19
|
+
In your layout...
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
<%= metatags %>
|
23
|
+
```
|
24
|
+
|
25
|
+
What you get...
|
26
|
+
|
27
|
+
```
|
28
|
+
<meta content="Lorem Ipsum" property="og:title" />
|
29
|
+
```
|
30
|
+
|
31
|
+
#Lazy evaluation
|
32
|
+
|
33
|
+
You can optionally pass a block to add_meta which will be evaluated in context of the view, this is useful when you need to access view helpers.
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
add_meta { {:property => 'og:image', :content => path_to_image('image.jpg')} }
|
37
|
+
```
|
38
|
+
|
39
|
+
This could also be written like:
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
add_meta({:property => 'og:image'}) { {:content => path_to_image('image.jpg')} }
|
43
|
+
```
|
44
|
+
|
45
|
+
The hash returned from the block gets merged with the set of attributes passed to the method.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metatags
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-06-27 00:00:00.000000000 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
description:
|
16
|
-
email:
|
16
|
+
email: john.butler@betapond.com
|
17
17
|
executables: []
|
18
18
|
extensions: []
|
19
19
|
extra_rdoc_files: []
|
@@ -24,7 +24,7 @@ files:
|
|
24
24
|
- lib/metatags.rb
|
25
25
|
- readme.markdown
|
26
26
|
has_rdoc: true
|
27
|
-
homepage:
|
27
|
+
homepage: https://github.com/betapond/metatags
|
28
28
|
licenses: []
|
29
29
|
post_install_message:
|
30
30
|
rdoc_options: []
|
@@ -47,6 +47,6 @@ rubyforge_project:
|
|
47
47
|
rubygems_version: 1.6.2
|
48
48
|
signing_key:
|
49
49
|
specification_version: 3
|
50
|
-
summary: A simple meta tag generator that doesn't
|
50
|
+
summary: A simple meta tag generator that doesn't screw with the attributes that you're
|
51
51
|
setting.
|
52
52
|
test_files: []
|