meta-tags 2.8.0 → 2.9.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6c154acfd9aee3e03d552f48a280f283d2b1daf3
4
- data.tar.gz: c053a4f2c0eee6dbb7f3a3ee3aae83ea2028247c
3
+ metadata.gz: b90c0d13b837e1d5736014dd1907c589db8515da
4
+ data.tar.gz: 09064672e14acc5a9cbec0aae1fbc31e5e43d9a2
5
5
  SHA512:
6
- metadata.gz: 4f5a3d2473bac40102f8fcd84c86bff95cd9fb740ddc81118da94e4f683e969debebab8069656dea3e6de248163dc6c388d6cdab19f02bd9c97fb8f0151fcc55
7
- data.tar.gz: 31468642280f4026434f939e838aa7d2c8e9dc9c6890ac7af5d9fee4f9aad4c624073b07ea5cdd7ec518a74462804268d89ac56b2125d31614b2b5469eb5c891
6
+ metadata.gz: e49fbc418b77ab01cc64d5ad7bd63aae28fda4fba04cae0c45cb0dfc131bc80c05497abd1779ddc64fbb11b83e8449c82a136ab49230c90c99e6ea6d505366a6
7
+ data.tar.gz: 5520dff10b082e2c5c908a30f61507d096022e4c614e731e2af69b4d2ee536ceae0e14182969d4aaa01e7f007d6123cd97110ea14079fb6dbfa07979c306766a
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -9,18 +9,22 @@ env:
9
9
  matrix:
10
10
  - RAILS_VERSION=4.2.10
11
11
  - RAILS_VERSION=5.0.6
12
- - RAILS_VERSION=5.1.4
12
+ - RAILS_VERSION=5.1.5
13
13
 
14
14
  rvm:
15
- - 2.2.9
16
- - 2.3.6
17
- - 2.4.3
18
- - 2.5.0
15
+ - 2.2.10
16
+ - 2.3.7
17
+ - 2.4.4
18
+ - 2.5.1
19
19
 
20
20
  notifications:
21
21
  recipients:
22
22
  - kpumuk@kpumuk.info
23
23
 
24
+ before_install:
25
+ - gem update --system
26
+ - gem install bundler -v 1.16.1
27
+
24
28
  before_script:
25
29
  - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
26
30
  - chmod +x ./cc-test-reporter
@@ -1,3 +1,8 @@
1
+ ## 2.9.0 (March 29, 2018) [☰](https://github.com/kpumuk/meta-tags/compare/v2.8.0...v2.9.0)
2
+
3
+ Features:
4
+ - Added ability to add `index` robots meta tag (thanks to @rafallo)
5
+
1
6
  ## 2.8.0 (February 28, 2018) [☰](https://github.com/kpumuk/meta-tags/compare/v2.7.1...v2.8.0)
2
7
 
3
8
  Features:
data/README.md CHANGED
@@ -147,6 +147,7 @@ Use these options to customize the title format:
147
147
  * `:lowercase` — when true, the page name will be lowercase;
148
148
  * `:reverse` — when true, the page and site names will be reversed;
149
149
  * `:noindex` — add noindex meta tag; when true, 'robots' will be used, otherwise the string will be used;
150
+ * `:index` — add index meta tag; when true, 'robots' will be used, otherwise the string will be used;
150
151
  * `:nofollow` — add nofollow meta tag; when true, 'robots' will be used, otherwise the string will be used;
151
152
  * `:follow` – add follow meta tag; when true, 'robots' will be used, otherwise the string will be used;
152
153
  * `:noarchive` – add noarchive meta tag; when true, 'robots' will be used, otherwise the string will be used;
@@ -344,6 +345,15 @@ Further reading:
344
345
  * [Blocking Google](http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=93708)
345
346
  * [Using meta tags to block access to your site](http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=93710)
346
347
 
348
+ ### Index
349
+
350
+ Although it is not required to add 'index' to 'robots' as it is default value for Google, some SEO specialists recommend to add it to website
351
+
352
+ ```ruby
353
+ set_meta_tags index: true
354
+ # <meta name="robots" content="index">
355
+ ```
356
+
347
357
  ### Nofollow
348
358
 
349
359
  Nofollow meta tag tells a search engine not to follow the links on a specific
@@ -138,18 +138,19 @@ module MetaTags
138
138
  # @return [Hash<String,String>] noindex attributes.
139
139
  #
140
140
  def extract_noindex
141
- noindex_name, noindex_value = extract_noindex_attribute(:noindex)
141
+ noindex_name, noindex_value = extract_noindex_attribute(:noindex)
142
+ index_name, index_value = extract_noindex_attribute(:index)
143
+
142
144
  nofollow_name, nofollow_value = extract_noindex_attribute(:nofollow)
143
- follow_name, follow_value = extract_noindex_attribute(:follow)
145
+ follow_name, follow_value = extract_noindex_attribute(:follow)
144
146
 
145
- noindex_attributes = if noindex_name == follow_name && (follow_value && noindex_value)
146
- { noindex_name => [noindex_value, follow_value].compact.join(', ') }
147
- elsif noindex_name == nofollow_name
148
- { noindex_name => [noindex_value, nofollow_value].compact.join(', ') }
147
+ noindex_attributes = if noindex_name == follow_name && (noindex_value || follow_value)
148
+ # noindex has higher priority than index and follow has higher priority than nofollow
149
+ [[noindex_name, noindex_value || index_value], [follow_name, follow_value || nofollow_value]]
149
150
  else
150
- { noindex_name => noindex_value, nofollow_name => nofollow_value }
151
+ [[index_name, index_value], [follow_name, follow_value], [noindex_name, noindex_value], [nofollow_name, nofollow_value]]
151
152
  end
152
- append_noarchive_attribute noindex_attributes
153
+ append_noarchive_attribute group_attributes_by_key noindex_attributes
153
154
  end
154
155
 
155
156
  protected
@@ -205,5 +206,14 @@ module MetaTags
205
206
  end
206
207
  noindex
207
208
  end
209
+
210
+ # Convert array of arrays to hashes and concatenate values
211
+ #
212
+ # @param [Array<Array>] attributes list of noindex keys and values
213
+ # @return [Hash<String, String>] hash of grouped noindex keys and values
214
+ #
215
+ def group_attributes_by_key(attributes)
216
+ Hash[attributes.group_by(&:first).map { |k, v| [k, v.map(&:last).compact.join(', ')] }]
217
+ end
208
218
  end
209
219
  end
@@ -1,4 +1,4 @@
1
1
  module MetaTags
2
2
  # Gem version.
3
- VERSION = '2.8.0'.freeze
3
+ VERSION = '2.9.0'.freeze
4
4
  end
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.8.0
4
+ version: 2.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmytro Shteflyuk
@@ -30,7 +30,7 @@ cert_chain:
30
30
  QwaoNrsQi488Dsk54YiNQWVouzfjRqEa4uUxSyKmRfQp7MNILESAOCXM+wZIxanu
31
31
  C9c9eUxgNTnHhsR3sK0QCIMwtUI=
32
32
  -----END CERTIFICATE-----
33
- date: 2018-03-01 00:00:00.000000000 Z
33
+ date: 2018-03-29 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: actionpack
metadata.gz.sig CHANGED
Binary file