meta-tags 2.11.1 → 2.12.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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +9 -0
- data/Gemfile +4 -2
- data/README.md +6 -6
- data/lib/meta_tags/meta_tags_collection.rb +31 -45
- data/lib/meta_tags/renderer.rb +2 -2
- data/lib/meta_tags/text_normalizer.rb +1 -1
- data/lib/meta_tags/version.rb +2 -1
- metadata +3 -4
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae6b586b3caea1141de4d7cfb8b9416225cdfda41984b7701252ca24dc3f72b7
|
4
|
+
data.tar.gz: ca6f213ed867a6e823a313f71bea1f19df6276455363e4ff294282f127e65e67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff1e6c26b63aa876c92034f4846a4058da17b2e6ae49e07640b75a9f6a2cf97eaf0bff6c48a715c13798c5de8e3334781c6f11313e19a9edd084e8fa84272c20
|
7
|
+
data.tar.gz: efc21b0da382e96fca80c78fdfaac56c3e3320e38223bd07f0157f85e91bf1aed92df090721d67600871e705a1718779b45fc01daf4cabf2bc6180b82bd9de76
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
## 2.12.0 (September 10, 2019) [☰](https://github.com/kpumuk/meta-tags/compare/v2.11.1...v2.12.0)
|
2
|
+
|
3
|
+
Features:
|
4
|
+
- Indexing directives (`noindex`, `nofollow`, etc. now support an array of robot names as a value).
|
5
|
+
- Added support for `link[rel='manifest']` ([199](https://github.com/kpumuk/meta-tags/pull/199))
|
6
|
+
|
7
|
+
Bugfixes:
|
8
|
+
- When `noindex` uses "robots" as a value, `nofollow` ignores a custom robot name, and switches to "robots" as well
|
9
|
+
|
1
10
|
## 2.11.1 (January 19, 2019) [☰](https://github.com/kpumuk/meta-tags/compare/v2.11.0...v2.11.1)
|
2
11
|
|
3
12
|
Features:
|
data/Gemfile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
source '
|
3
|
+
source 'https://rubygems.org'
|
4
4
|
|
5
5
|
# Specify your gem's dependencies in meta-tags.gemspec
|
6
6
|
gemspec
|
@@ -13,7 +13,9 @@ end
|
|
13
13
|
group :test do
|
14
14
|
# Lock rubocop to a specific version we use on CI. If you update this,
|
15
15
|
# don't forget to switch rubocop channel in the .codeclimate.yml
|
16
|
-
gem 'rubocop', '0.
|
16
|
+
gem 'rubocop', '~> 0.74.0'
|
17
|
+
# Cops for rails apps
|
18
|
+
gem 'rubocop-rails'
|
17
19
|
# Apply RSpec rubocop cops
|
18
20
|
gem 'rubocop-rspec', require: false
|
19
21
|
# We use this gem on CI to calculate code coverage.
|
data/README.md
CHANGED
@@ -36,7 +36,7 @@ truncation have recommended values, you can change them to reflect your own
|
|
36
36
|
preferences. Keywords are converted to lowercase by default, but this is also
|
37
37
|
configurable.
|
38
38
|
|
39
|
-
To
|
39
|
+
To override the defaults, create an initializer
|
40
40
|
`config/initializers/meta_tags.rb` using the following command:
|
41
41
|
|
42
42
|
```bash
|
@@ -164,11 +164,11 @@ Use these options to customize the title format:
|
|
164
164
|
| `:suffix` | text between separator and page title |
|
165
165
|
| `:lowercase` | when true, the page name will be lowercase |
|
166
166
|
| `:reverse` | when true, the page and site names will be reversed |
|
167
|
-
| `:noindex` | add noindex meta tag; when true, 'robots' will be used
|
168
|
-
| `:index` | add index meta tag; when true, 'robots' will be used
|
169
|
-
| `:nofollow` | add nofollow meta tag; when true, 'robots' will be used
|
170
|
-
| `:follow` | add follow meta tag; when true, 'robots' will be used
|
171
|
-
| `:noarchive` | add noarchive meta tag; when true, 'robots' will be used
|
167
|
+
| `:noindex` | add noindex meta tag; when true, 'robots' will be used; accepts a string with a robot name, or an array of strings |
|
168
|
+
| `:index` | add index meta tag; when true, 'robots' will be used; accepts a string with a robot name, or an array of strings |
|
169
|
+
| `:nofollow` | add nofollow meta tag; when true, 'robots' will be used; accepts a string with a robot name, or an array of strings |
|
170
|
+
| `:follow` | add follow meta tag; when true, 'robots' will be used; accepts a string with a robot name, or an array of strings |
|
171
|
+
| `:noarchive` | add noarchive meta tag; when true, 'robots' will be used; accepts a string with a robot name, or an array of strings |
|
172
172
|
| `:canonical` | add canonical link tag |
|
173
173
|
| `:prev` | add prev link tag |
|
174
174
|
| `:next` | add next link tag |
|
@@ -142,28 +142,20 @@ module MetaTags
|
|
142
142
|
#
|
143
143
|
# @return [Hash<String,String>] noindex attributes.
|
144
144
|
#
|
145
|
-
def
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
[
|
160
|
-
[index_name, index_value],
|
161
|
-
[follow_name, follow_value],
|
162
|
-
[noindex_name, noindex_value],
|
163
|
-
[nofollow_name, nofollow_value],
|
164
|
-
]
|
165
|
-
end
|
166
|
-
append_noarchive_attribute group_attributes_by_key noindex_attributes
|
145
|
+
def extract_robots
|
146
|
+
result = Hash.new { |h, k| h[k] = [] }
|
147
|
+
|
148
|
+
[
|
149
|
+
# noindex has higher priority than index
|
150
|
+
[:noindex, :index],
|
151
|
+
# follow has higher priority than nofollow
|
152
|
+
[:follow, :nofollow],
|
153
|
+
:noarchive,
|
154
|
+
].each do |attributes|
|
155
|
+
calculate_robots_attributes(result, attributes)
|
156
|
+
end
|
157
|
+
|
158
|
+
result.transform_values { |v| v.join(', ') }
|
167
159
|
end
|
168
160
|
|
169
161
|
protected
|
@@ -190,43 +182,37 @@ module MetaTags
|
|
190
182
|
meta_tags[name] == false ? '' : (meta_tags[name] || default)
|
191
183
|
end
|
192
184
|
|
193
|
-
# Extracts
|
185
|
+
# Extracts robots attribute (noindex, nofollow, etc) name and value.
|
194
186
|
#
|
195
187
|
# @param [String, Symbol] name noindex attribute name.
|
196
188
|
# @return [Array<String>] pair of noindex attribute name and value.
|
197
189
|
#
|
198
|
-
def
|
190
|
+
def extract_robots_attribute(name)
|
199
191
|
noindex = extract(name)
|
200
|
-
noindex_name = noindex.kind_of?(String) ? noindex : 'robots'
|
192
|
+
noindex_name = noindex.kind_of?(String) || noindex.kind_of?(Array) ? noindex : 'robots'
|
201
193
|
noindex_value = noindex ? name.to_s : nil
|
202
194
|
|
203
195
|
[ noindex_name, noindex_value ]
|
204
196
|
end
|
205
197
|
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
if noindex[noarchive_name].blank?
|
215
|
-
noindex[noarchive_name] = noarchive_value
|
216
|
-
else
|
217
|
-
noindex[noarchive_name] += ", #{noarchive_value}"
|
198
|
+
def calculate_robots_attributes(result, attributes)
|
199
|
+
processed = Set.new
|
200
|
+
Array(attributes).each do |attribute|
|
201
|
+
names, value = extract_robots_attribute(attribute)
|
202
|
+
next unless value
|
203
|
+
|
204
|
+
Array(names).each do |name|
|
205
|
+
apply_robots_value(result, name, value, processed)
|
218
206
|
end
|
219
207
|
end
|
220
|
-
noindex
|
221
208
|
end
|
222
209
|
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
Hash[attributes.group_by(&:first).map { |k, v| [k, v.map(&:last).tap(&:compact!).join(', ')] }]
|
210
|
+
def apply_robots_value(result, name, value, processed)
|
211
|
+
name = name.to_s
|
212
|
+
return if processed.include?(name)
|
213
|
+
|
214
|
+
result[name] << value
|
215
|
+
processed << name
|
230
216
|
end
|
231
217
|
end
|
232
218
|
end
|
data/lib/meta_tags/renderer.rb
CHANGED
@@ -97,7 +97,7 @@ module MetaTags
|
|
97
97
|
# @param [Array<Tag>] tags a buffer object to store tag in.
|
98
98
|
#
|
99
99
|
def render_noindex(tags)
|
100
|
-
meta_tags.
|
100
|
+
meta_tags.extract_robots.each do |name, content|
|
101
101
|
tags << Tag.new(:meta, name: name, content: content) if content.present?
|
102
102
|
end
|
103
103
|
end
|
@@ -150,7 +150,7 @@ module MetaTags
|
|
150
150
|
# @param [Array<Tag>] tags a buffer object to store tag in.
|
151
151
|
#
|
152
152
|
def render_links(tags)
|
153
|
-
[ :amphtml, :canonical, :prev, :next, :image_src ].each do |tag_name|
|
153
|
+
[ :amphtml, :canonical, :prev, :next, :image_src, :manifest ].each do |tag_name|
|
154
154
|
href = meta_tags.extract(tag_name)
|
155
155
|
if href.present?
|
156
156
|
@normalized_meta_tags[tag_name] = href
|
data/lib/meta_tags/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: meta-tags
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmytro Shteflyuk
|
@@ -29,7 +29,7 @@ cert_chain:
|
|
29
29
|
j0ZkOZOMk6hzny9+AnYZ7eiUqp/XX7Hn+hqtl/AebKhbFapnTu0n7KcfM0oDaLUr
|
30
30
|
Fc+FAHErSClMb7YN
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date: 2019-
|
32
|
+
date: 2019-09-11 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: actionpack
|
@@ -141,8 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
version: '0'
|
143
143
|
requirements: []
|
144
|
-
|
145
|
-
rubygems_version: 2.7.6
|
144
|
+
rubygems_version: 3.0.4
|
146
145
|
signing_key:
|
147
146
|
specification_version: 4
|
148
147
|
summary: Collection of SEO helpers for Ruby on Rails.
|
metadata.gz.sig
CHANGED
Binary file
|