jt-rails-meta 1.0.9 → 1.0.10
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.
- checksums.yaml +4 -4
- data/README.md +8 -8
- data/Rakefile +2 -0
- data/jt-rails-meta.gemspec +1 -1
- data/lib/jt-rails-meta.rb +13 -14
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90d6598dedd750377fa320ff39c4c5a018bea21d
|
4
|
+
data.tar.gz: 1d57fdc72a1e54de3254e0166afde2f4731b218c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3cfad024bf005f490957ba9a210a758db98137537ad09bf2d92a734a2f7fd049d0204cf6154f27a8ab51cfaae040ec51c8aaf2f2d76d560b506e8c72e23fffcc
|
7
|
+
data.tar.gz: 3d3617233700f545774aa98f2934fe1559be8057521f2cb756399975f3f7e78140e2fe8875a92bbb20a4045aecafb6801b208eb705d4a52766feab6e1caa34e9
|
data/README.md
CHANGED
@@ -10,7 +10,7 @@ JTRailsMeta is distributed as a gem, which is how it should be used in your app.
|
|
10
10
|
|
11
11
|
Include the gem in your Gemfile:
|
12
12
|
|
13
|
-
|
13
|
+
gem 'jt-rails-meta', '~> 1.0'
|
14
14
|
|
15
15
|
Create a `meta.yml` file for the translations:
|
16
16
|
|
@@ -34,8 +34,8 @@ Call `meta_tags` in your layout:
|
|
34
34
|
```html
|
35
35
|
<!DOCTYPE html>
|
36
36
|
<head>
|
37
|
-
|
38
|
-
|
37
|
+
<meta charset="UTF-8" />
|
38
|
+
<%= meta_tags %>
|
39
39
|
</head>
|
40
40
|
<body>
|
41
41
|
</body>
|
@@ -83,13 +83,13 @@ In your controller:
|
|
83
83
|
|
84
84
|
```ruby
|
85
85
|
class PostsController < ApplicationController
|
86
|
-
|
87
|
-
|
86
|
+
def show
|
87
|
+
@post = Post.find(params[:id])
|
88
88
|
|
89
|
-
|
90
|
-
|
89
|
+
set_meta_title({ title: @post.title })
|
90
|
+
set_meta_description({ title: @post.title, author: @post.author })
|
91
91
|
add_meta_keywords(@post.tags.map(&:name))
|
92
|
-
|
92
|
+
end
|
93
93
|
end
|
94
94
|
```
|
95
95
|
|
data/Rakefile
ADDED
data/jt-rails-meta.gemspec
CHANGED
@@ -3,7 +3,7 @@ Gem::Specification.new do |s|
|
|
3
3
|
s.summary = "Manage HTML meta tags for SEO in Ruby On Rails"
|
4
4
|
s.description = "JTRailsMeta help you to manage HTML meta tags like title, description, keywords used in Search Engine Optimization (SEO)."
|
5
5
|
s.homepage = 'https://github.com/jonathantribouharet/jt-rails-meta'
|
6
|
-
s.version = '1.0.
|
6
|
+
s.version = '1.0.10'
|
7
7
|
s.files = `git ls-files`.split("\n")
|
8
8
|
s.require_paths = ['lib']
|
9
9
|
s.authors = ['Jonathan TRIBOUHARET']
|
data/lib/jt-rails-meta.rb
CHANGED
@@ -18,21 +18,21 @@ module JT::Rails::Meta
|
|
18
18
|
def meta_tags
|
19
19
|
output = ""
|
20
20
|
|
21
|
-
output
|
22
|
-
output
|
23
|
-
output
|
24
|
-
output
|
25
|
-
output
|
26
|
-
output
|
21
|
+
output << content_tag 'title', meta_title
|
22
|
+
output << "\n"
|
23
|
+
output << tag 'meta', name: 'description', content: meta_description
|
24
|
+
output << "\n"
|
25
|
+
output << tag 'meta', name: 'keywords', content: meta_keywords
|
26
|
+
output << "\n"
|
27
27
|
|
28
28
|
for link in @meta[:links]
|
29
|
-
output
|
30
|
-
output
|
29
|
+
output << tag 'link', link[:options]
|
30
|
+
output << "\n"
|
31
31
|
end
|
32
32
|
|
33
33
|
for extra_params in @meta[:extra]
|
34
|
-
output
|
35
|
-
output
|
34
|
+
output << tag 'meta', name: extra_params[:name], content: extra_params[:content]
|
35
|
+
output << "\n"
|
36
36
|
end
|
37
37
|
|
38
38
|
output.html_safe
|
@@ -93,9 +93,8 @@ module JT::Rails::Meta
|
|
93
93
|
# +options+:: options passed to I18n
|
94
94
|
def set_meta_keywords(options = {})
|
95
95
|
keywords = I18n.translate("#{meta_key}.keywords", options)
|
96
|
-
if !have_translation?(keywords)
|
97
|
-
|
98
|
-
end
|
96
|
+
keywords = I18n.translate('meta.default.keywords') if !have_translation?(keywords)
|
97
|
+
keywords = '' if !have_translation(keywords)
|
99
98
|
|
100
99
|
if @meta[:keywords].blank?
|
101
100
|
@meta[:keywords] = keywords
|
@@ -144,7 +143,7 @@ module JT::Rails::Meta
|
|
144
143
|
@meta[:links] << {options: options}
|
145
144
|
end
|
146
145
|
|
147
|
-
# Helpers
|
146
|
+
# Helpers
|
148
147
|
|
149
148
|
def add_meta_link_canonical(url)
|
150
149
|
add_meta_link 'canonical', url
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jt-rails-meta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan TRIBOUHARET
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: JTRailsMeta help you to manage HTML meta tags like title, description,
|
14
14
|
keywords used in Search Engine Optimization (SEO).
|
@@ -21,6 +21,7 @@ files:
|
|
21
21
|
- Gemfile
|
22
22
|
- LICENSE
|
23
23
|
- README.md
|
24
|
+
- Rakefile
|
24
25
|
- jt-rails-meta.gemspec
|
25
26
|
- lib/generators/jt/meta/USAGE
|
26
27
|
- lib/generators/jt/meta/meta_generator.rb
|
@@ -46,7 +47,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
46
47
|
version: '0'
|
47
48
|
requirements: []
|
48
49
|
rubyforge_project:
|
49
|
-
rubygems_version: 2.0.14
|
50
|
+
rubygems_version: 2.0.14.1
|
50
51
|
signing_key:
|
51
52
|
specification_version: 4
|
52
53
|
summary: Manage HTML meta tags for SEO in Ruby On Rails
|