meta-tags-helpers 0.1.0

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.
Files changed (2) hide show
  1. data/README.md +111 -0
  2. metadata +98 -0
data/README.md ADDED
@@ -0,0 +1,111 @@
1
+ # meta-tags-helpers
2
+
3
+ ## Rails meta tags helpers
4
+
5
+ Seo and future-proof meta-tags for Rails, with good customizable defaults that support open-graph: all your meta tags with a single call!
6
+
7
+ ### Install
8
+
9
+ ``` rb
10
+ gem 'meta-tags-helpers'
11
+ ```
12
+
13
+ ### Examples
14
+
15
+ ``` erb
16
+ <%= meta_tags(
17
+ :title => "MyBlog - This is a Blog",
18
+ :description => "The blog of mine & a reserved character",
19
+ :og => {:type => "website"}
20
+ :ns => {
21
+ :my_custom_meta => "a value"
22
+ }
23
+ )
24
+ %>
25
+ ```
26
+
27
+ or using defaults with setters (see below) just:
28
+
29
+ ``` erb
30
+ <%= meta_tags %>
31
+ ```
32
+
33
+ ### What it generates?
34
+
35
+ The first example above will produce the following html:
36
+
37
+ ``` html
38
+ <meta name="charset" content="utf-8" />
39
+ <meta name="X-UA-Compatible" content="IE=edge,chrome=1" />
40
+ <meta name="viewport" content="width=device-width" />
41
+ <title>MyBlog - This is a Blog</title>
42
+ <meta name="description" content="The blog of mine &amp; a reserved character" />
43
+ <meta name="og:url" content="(THE CURRENT REQUESTED URL)" />
44
+ <meta name="og:type" content="website" />
45
+ <meta name="og:title" content="MyBlog - This is a Blog" />
46
+ <meta name="og:description" content="The blog of mine &amp; a reserved character" />
47
+ <meta name="ns:my_custom_meta" content="a value" />
48
+ <meta name="csrf-param" content="..." />
49
+ <meta name="csrf-token" content="..." />
50
+
51
+ ```
52
+
53
+ ### Setting meta tags from controller/partials/other views
54
+
55
+ You can get/set some of defautls (see below) through handy helpers within controllers or views:
56
+
57
+ ``` rb
58
+ meta_title(value = nil) # get or set "meta_title" used in defaults
59
+ meta_description(value = nil)
60
+ meta_image(value = nil)
61
+ meta_type(value = nil)
62
+
63
+ ```
64
+
65
+ ### Defaults
66
+
67
+ This is the default options hash:
68
+
69
+ ``` rb
70
+ default = {
71
+ :charset => "utf-8",
72
+ :"X-UA-Compatible" => "IE=edge,chrome=1",
73
+ :viewport => "width=device-width",
74
+ :title => meta_title,
75
+ :description => meta_description,
76
+ :og => {
77
+ :url => "#{request.url}",
78
+ :type => meta_type || "article",
79
+ :title => opts[:title] || meta_title,
80
+ :description => opts[:description] || meta_description,
81
+ :image => (opts[:og] && opts[:og][:image]) || meta_image
82
+ }
83
+ }
84
+
85
+ ```
86
+
87
+
88
+ ---
89
+
90
+ Copyright (c) 2012 mcasimir
91
+
92
+ MIT License
93
+
94
+ Permission is hereby granted, free of charge, to any person obtaining
95
+ a copy of this software and associated documentation files (the
96
+ "Software"), to deal in the Software without restriction, including
97
+ without limitation the rights to use, copy, modify, merge, publish,
98
+ distribute, sublicense, and/or sell copies of the Software, and to
99
+ permit persons to whom the Software is furnished to do so, subject to
100
+ the following conditions:
101
+
102
+ The above copyright notice and this permission notice shall be
103
+ included in all copies or substantial portions of the Software.
104
+
105
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
106
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
107
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
108
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
109
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
110
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
111
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: meta-tags-helpers
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - mcasimir
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-08-06 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: bundler
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: jeweler
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 1.8.4
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 1.8.4
62
+ description: Rails meta tags helpers
63
+ email: maurizio.cas@gmail.com
64
+ executables: []
65
+ extensions: []
66
+ extra_rdoc_files:
67
+ - README.md
68
+ files:
69
+ - README.md
70
+ homepage: http://github.com/mcasimir/kaminari-bootstrap
71
+ licenses:
72
+ - MIT
73
+ post_install_message:
74
+ rdoc_options: []
75
+ require_paths:
76
+ - lib
77
+ required_ruby_version: !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ segments:
84
+ - 0
85
+ hash: 2464010401342255116
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ none: false
88
+ requirements:
89
+ - - ! '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubyforge_project:
94
+ rubygems_version: 1.8.24
95
+ signing_key:
96
+ specification_version: 3
97
+ summary: Rails meta tags helpers
98
+ test_files: []