jekyll-seo-tag 2.2.1 → 2.2.2

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: d007bd49496c661cf441f17dc25d6756ae9daf31
4
- data.tar.gz: c1a2dc3f79edacd4d68fedc1c8f518249a5a59a3
3
+ metadata.gz: '026698a5195b405a9a4c48b49e002f648d19c7bd'
4
+ data.tar.gz: d7a9f7ed597cd9d708f0354f2334a5fc424ba9b1
5
5
  SHA512:
6
- metadata.gz: 0eec356674ff4054de62b1d022cbf206496fc4eb17dc2933137764851310b5350d1b0b6bd8403ff80a2faf9e8184f8a85d4eeeecf572752d2ea8d5cfe0c68e36
7
- data.tar.gz: 12088f4299da9829ab61d2c04ce1994cbcd3999f32cd3489aab59053bcf1b3584342e9c4e6bddf1cd082e95032094d2179c0713977f4eea5e4ab338e8e52e3f5
6
+ metadata.gz: 5eb1720decf7faf0eaff8d1550637ac54a1321303fd08ca0dda2685d6f70ef8a44a1707992b9e8f63061efa6cc563f1b09d7db2db9ca16d3091f74716846def6
7
+ data.tar.gz: ecfa02bf252edf0ab07c23d8995bb8f4478879bb6426619e1091fdb1d400349b044375cb8d9af844b0ce382120a825e907466e27f031cf5817a00ca169d429d7
data/Gemfile CHANGED
@@ -3,14 +3,3 @@ require "json"
3
3
  require "open-uri"
4
4
 
5
5
  gemspec
6
-
7
- group :development, :test do
8
- versions = JSON.parse(open("https://pages.github.com/versions.json").read)
9
- versions.delete("ruby")
10
- versions.delete("jekyll-seo-tag")
11
- versions.delete("github-pages")
12
-
13
- versions.each do |dep, version|
14
- gem dep, version
15
- end
16
- end
@@ -1,5 +1,18 @@
1
1
  ## HEAD
2
2
 
3
+ ## 2.2.2
4
+
5
+ ### Minor Enhancements
6
+
7
+ * Guard against arrays in subhashes #197
8
+ * Guard against invalid or missing URLs #199
9
+
10
+ ### Development fixes
11
+
12
+ * Remove dynamic GitHub Pages logic from Gemfile #194
13
+
14
+ ## 2.2.1
15
+
3
16
  * Convert template logic to a Liquid Drop (significant performance improvement) (#184)
4
17
  * Fix for JSON-LD validation warning for images missing required properties (#183)
5
18
 
@@ -55,8 +55,8 @@ module Jekyll
55
55
  seo_name
56
56
  elsif !homepage_or_about?
57
57
  nil
58
- elsif site["social"] && site["social"]["name"]
59
- format_string site["social"]["name"]
58
+ elsif site_social["name"]
59
+ format_string site_social["name"]
60
60
  elsif site_title
61
61
  format_string site_title
62
62
  end
@@ -95,8 +95,8 @@ module Jekyll
95
95
 
96
96
  def date_modified
97
97
  @date_modified ||= begin
98
- date = if page["seo"] && page["seo"]["date_modified"]
99
- page["seo"]["date_modified"]
98
+ date = if page_seo["date_modified"]
99
+ page_seo["date_modified"]
100
100
  elsif page["last_modified_at"]
101
101
  page["last_modified_at"].to_liquid
102
102
  else
@@ -112,8 +112,8 @@ module Jekyll
112
112
 
113
113
  def type
114
114
  @type ||= begin
115
- if page["seo"] && page["seo"]["type"]
116
- page["seo"]["type"]
115
+ if page_seo["type"]
116
+ page_seo["type"]
117
117
  elsif homepage_or_about?
118
118
  "WebSite"
119
119
  elsif page["date"]
@@ -126,10 +126,10 @@ module Jekyll
126
126
 
127
127
  def links
128
128
  @links ||= begin
129
- if page["seo"] && page["seo"]["links"]
130
- page["seo"]["links"]
131
- elsif homepage_or_about? && site["social"] && site["social"]["links"]
132
- site["social"]["links"]
129
+ if page_seo["links"]
130
+ page_seo["links"]
131
+ elsif homepage_or_about? && site_social["links"]
132
+ site_social["links"]
133
133
  end
134
134
  end
135
135
  end
@@ -162,6 +162,7 @@ module Jekyll
162
162
 
163
163
  image = { "path" => image } if image.is_a?(String)
164
164
  image["path"] ||= image["facebook"] || image["twitter"]
165
+ return @image = nil unless image["path"]
165
166
 
166
167
  unless absolute_url? image["path"]
167
168
  image["path"] = filters.absolute_url image["path"]
@@ -177,7 +178,9 @@ module Jekyll
177
178
  end
178
179
 
179
180
  def canonical_url
180
- @canonical_url ||= filters.absolute_url(page["url"]).gsub(%r!/index\.html$!, "/")
181
+ @canonical_url ||= begin
182
+ filters.absolute_url(page["url"]).to_s.gsub(%r!/index\.html$!, "/")
183
+ end
181
184
  end
182
185
 
183
186
  private
@@ -205,7 +208,10 @@ module Jekyll
205
208
  end
206
209
 
207
210
  def absolute_url?(string)
211
+ return unless string
208
212
  Addressable::URI.parse(string).absolute?
213
+ rescue Addressable::URI::InvalidURIError
214
+ nil
209
215
  end
210
216
 
211
217
  def format_string(string)
@@ -237,7 +243,29 @@ module Jekyll
237
243
  end
238
244
 
239
245
  def seo_name
240
- @seo_name ||= format_string(page["seo"]["name"]) if page["seo"]
246
+ @seo_name ||= format_string(page_seo["name"]) if page_seo["name"]
247
+ end
248
+
249
+ def page_seo
250
+ @page_seo ||= sub_hash(page, "seo")
251
+ end
252
+
253
+ def site_social
254
+ @site_social ||= sub_hash(site, "social")
255
+ end
256
+
257
+ # Safely returns a sub hash
258
+ #
259
+ # hash - the parent hash
260
+ # key - the key in the parent hash
261
+ #
262
+ # Returns the sub hash or an empty hash, if it does not exist
263
+ def sub_hash(hash, key)
264
+ if hash[key].is_a?(Hash)
265
+ hash[key]
266
+ else
267
+ {}
268
+ end
241
269
  end
242
270
  end
243
271
  end
@@ -3,6 +3,6 @@ module Liquid; class Tag; end; end
3
3
 
4
4
  module Jekyll
5
5
  class SeoTag < Liquid::Tag
6
- VERSION = "2.2.1".freeze
6
+ VERSION = "2.2.2".freeze
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-seo-tag
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Balter
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-25 00:00:00.000000000 Z
11
+ date: 2017-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll