jekyll-seo-tag 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7cc372667e8031faba02cb7bb2bf1e1a51be7fd6
4
- data.tar.gz: 37b8a3f10ecffdf6a300834c2088c915f0ac95a6
3
+ metadata.gz: 07d7b830b127017c667a9e58bd5c214e594558bc
4
+ data.tar.gz: a69f4f9cee9f45644add22a57245366cdbc1ddc1
5
5
  SHA512:
6
- metadata.gz: 021b61812fb8b3b08d8bf281ef2790ddad459e89349910bd434975d32b96a7b8cb9048bdfa138e44aa83114272ea9fc7b2689b7496c8c81187353331405376bc
7
- data.tar.gz: d75c74ddfdd904a31e0fc5c9eaef1c407d700fc0276c92b53aa2597f3b01b97ea953548cc9ad343ddca85d456d43ec8dae8e8c5633742e7478491b6f46ac28c8
6
+ metadata.gz: 52c022b593902ef22131b0e96ef497d188e73469a07a6c2ffa33c0619de08393eeeaae729556a8d368a1d45b0d9ce7907f64e1eb40a177abcbce1213989e82b6
7
+ data.tar.gz: 0a7309abed4b88e3c9b95a8f349cfae6ad0305b304a4901d3fcf7e1c4d637a16d6381a3b2fd6fe64eba7f9d2817d8d410a23a3700b7fb36fb20f0cb655be3677
@@ -1,3 +1,6 @@
1
+ inherit_gem:
2
+ jekyll: .rubocop.yml
3
+
1
4
  Metrics/LineLength:
2
5
  Exclude:
3
6
  - spec/**/*
@@ -8,3 +11,7 @@ Style/Documentation:
8
11
 
9
12
  Style/FileName:
10
13
  Enabled: false
14
+
15
+ AllCops:
16
+ Exclude:
17
+ - vendor/**/*
@@ -1,7 +1,7 @@
1
1
  rvm:
2
2
  - 2.2.3
3
3
  before_install: gem install bundler
4
- langauage: ruby
4
+ language: ruby
5
5
  script: script/cibuild
6
6
  sudo: false
7
7
  cache: bundler
data/Gemfile CHANGED
@@ -9,6 +9,7 @@ group :development, :test do
9
9
  versions.delete('ruby')
10
10
  versions.delete('jekyll-seo-tag')
11
11
  versions.delete('github-pages')
12
+ versions.delete('jekyll') # Remove this line when GitHub Pages supports 3.3.0
12
13
 
13
14
  versions.each do |dep, version|
14
15
  gem dep, version
@@ -0,0 +1,23 @@
1
+ ## HEAD
2
+
3
+ ### Major Enhancement
4
+
5
+ * Use new URL filters (#123)
6
+
7
+ ### Minor Enhancements
8
+
9
+ * Wraps logo image json data in a publisher property (#133)
10
+ * Fix duplicated `escape_once` (#93)
11
+ * Simplify minify regex (#125)
12
+ * Don't mangle text with newlines #126
13
+
14
+ ### Documentation
15
+
16
+ * Add front matter default example for image (#132)
17
+ * Fix tiny typo (#106)
18
+ * add example usage of social profiles (#139)
19
+
20
+ ### Development
21
+
22
+ * Inherit Jekyll's rubocop config for consistency (#109)
23
+ * Correct spelling in .travis.yml (#112)
data/README.md CHANGED
@@ -78,6 +78,19 @@ The SEO tag will respect any of the following if included in your site's `_confi
78
78
  * `social` - For [specifying social profiles](https://developers.google.com/structured-data/customize/social-profiles). The following properties are available:
79
79
  * `name` - If the user or organization name differs from the site's name
80
80
  * `links` - An array of links to social media profiles.
81
+
82
+ ```yml
83
+ social:
84
+ name: Ben Balter
85
+ links:
86
+ - https://twitter.com/BenBalter
87
+ - https://www.facebook.com/ben.balter
88
+ - https://www.linkedin.com/in/BenBalter
89
+ - https://plus.google.com/+BenBalter
90
+ - https://github.com/benbalter
91
+ - https://keybase.io/benbalter
92
+ ```
93
+
81
94
  * `google_site_verification` for verifying ownership via Google webmaster tools
82
95
 
83
96
  The SEO tag will respect the following YAML front matter if included in a post, page, or document:
@@ -101,7 +114,7 @@ If for some reason, you don't want the plugin to output `<title>` tags on each p
101
114
 
102
115
  ### Author information
103
116
 
104
- Author information is used to propagate the `creator` field of Twitter summary cards. This is should be an author-specific, not site-wide Twitter handle (the site-wide username be stored as `site.twitter.username`).
117
+ Author information is used to propagate the `creator` field of Twitter summary cards. This should be an author-specific, not site-wide Twitter handle (the site-wide username be stored as `site.twitter.username`).
105
118
 
106
119
  *TL;DR: In most cases, put `author: [your Twitter handle]` in the document's front matter, for sites with multiple authors. If you need something more complicated, read on.*
107
120
 
@@ -184,6 +197,20 @@ image:
184
197
  width: 100
185
198
  ```
186
199
 
200
+ ### Setting a default image
201
+
202
+ You can define a default image using [Front Matter default](https://jekyllrb.com/docs/configuration/#front-matter-defaults), to provide a default Twitter Card or OGP image to all of your posts and pages.
203
+
204
+ Here is a very basic example, that you are encouraged to adapt to your needs:
205
+
206
+ ```yml
207
+ defaults:
208
+ - scope:
209
+ path: ""
210
+ values:
211
+ image: /assets/images/default-card.png
212
+ ```
213
+
187
214
  ### SmartyPants Titles
188
215
 
189
216
  Titles will be processed using [Jekyll's `smartify` filter](https://jekyllrb.com/docs/templates/). This will use SmartyPants to translate plain ASCII punctuation into "smart" typographic punctuation. This will not render or strip any Markdown you may be using in a page title.
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
26
  spec.require_paths = ['lib']
27
27
 
28
- spec.add_dependency 'jekyll', '~> 3.1'
28
+ spec.add_dependency 'jekyll', '~> 3.3'
29
29
  spec.add_development_dependency 'bundler', '~> 1.10'
30
30
  spec.add_development_dependency 'rake', '~> 10.0'
31
31
  spec.add_development_dependency 'rspec', '~> 3.3'
@@ -1,11 +1,19 @@
1
- require 'jekyll-seo-tag/filters'
2
- require 'jekyll-seo-tag/version'
1
+ require "jekyll-seo-tag/version"
3
2
 
4
3
  module Jekyll
5
4
  class SeoTag < Liquid::Tag
6
5
  attr_accessor :context
7
6
 
8
- MINIFY_REGEX = /([>,]\n|[%}]})\s+?(<|{[{%]|[ ]+\")/
7
+ # Matches all whitespace that follows either
8
+ # 1. A '}', which closes a Liquid tag
9
+ # 2. A '{', which opens a JSON block
10
+ # 3. A '>' followed by a newline, which closes an XML tag or
11
+ # 4. A ',' followed by a newline, which ends a JSON line
12
+ # We will strip all of this whitespace to minify the template
13
+ # We will not strip any whitespace if the next character is a '-'
14
+ # so that we do not interfere with the HTML comment at the
15
+ # very begining
16
+ MINIFY_REGEX = %r!(?<=[{}]|[>,]\n)\s+(?\!-)!
9
17
 
10
18
  def initialize(_tag_name, text, _tokens)
11
19
  super
@@ -21,28 +29,28 @@ module Jekyll
21
29
 
22
30
  def options
23
31
  {
24
- 'version' => Jekyll::SeoTag::VERSION,
25
- 'title' => title?
32
+ "version" => Jekyll::SeoTag::VERSION,
33
+ "title" => title?
26
34
  }
27
35
  end
28
36
 
29
37
  def payload
30
38
  {
31
- 'page' => context.registers[:page],
32
- 'site' => context.registers[:site].site_payload['site'],
33
- 'paginator' => context['paginator'],
34
- 'seo_tag' => options
39
+ "page" => context.registers[:page],
40
+ "site" => context.registers[:site].site_payload["site"],
41
+ "paginator" => context["paginator"],
42
+ "seo_tag" => options
35
43
  }
36
44
  end
37
45
 
38
46
  def title?
39
- !(@text =~ /title=false/i)
47
+ !(@text =~ %r!title=false!i)
40
48
  end
41
49
 
42
50
  def info
43
51
  {
44
- registers: context.registers,
45
- filters: [Jekyll::Filters, JekyllSeoTag::Filters]
52
+ :registers => context.registers,
53
+ :filters => [Jekyll::Filters]
46
54
  }
47
55
  end
48
56
 
@@ -52,16 +60,16 @@ module Jekyll
52
60
 
53
61
  def template_contents
54
62
  @template_contents ||= begin
55
- File.read(template_path).gsub(MINIFY_REGEX, '\1\2').chomp
63
+ File.read(template_path).gsub(MINIFY_REGEX, "")
56
64
  end
57
65
  end
58
66
 
59
67
  def template_path
60
68
  @template_path ||= begin
61
- File.expand_path './template.html', File.dirname(__FILE__)
69
+ File.expand_path "./template.html", File.dirname(__FILE__)
62
70
  end
63
71
  end
64
72
  end
65
73
  end
66
74
 
67
- Liquid::Template.register_tag('seo', Jekyll::SeoTag)
75
+ Liquid::Template.register_tag("seo", Jekyll::SeoTag)
@@ -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.0.0'.freeze
6
+ VERSION = "2.1.0".freeze
7
7
  end
8
8
  end
@@ -4,10 +4,6 @@
4
4
  {% assign seo_homepage_or_about = true %}
5
5
  {% endif %}
6
6
 
7
- {% if site.url %}
8
- {% assign seo_url = site.url | append: site.baseurl %}
9
- {% endif %}
10
- {% assign seo_url = seo_url | default: site.github.url %}
11
7
  {% assign seo_site_title = site.title | default: site.name %}
12
8
 
13
9
  {% if page.title %}
@@ -34,24 +30,24 @@
34
30
  {% assign seo_name = seo_site_title %}
35
31
  {% endif %}
36
32
  {% if seo_name %}
37
- {% assign seo_name = seo_name | smartify | strip_html | strip_newlines | escape_once %}
33
+ {% assign seo_name = seo_name | smartify | strip_html | normalize_whitespace | escape_once %}
38
34
  {% endif %}
39
35
 
40
36
  {% if seo_title %}
41
- {% assign seo_title = seo_title | smartify | strip_html | strip_newlines | escape_once | escape_once %}
37
+ {% assign seo_title = seo_title | smartify | strip_html | normalize_whitespace | escape_once %}
42
38
  {% endif %}
43
39
 
44
40
  {% if seo_site_title %}
45
- {% assign seo_site_title = seo_site_title | smartify | strip_html | strip_newlines | escape_once %}
41
+ {% assign seo_site_title = seo_site_title | smartify | strip_html | normalize_whitespace | escape_once %}
46
42
  {% endif %}
47
43
 
48
44
  {% if seo_page_title %}
49
- {% assign seo_page_title = seo_page_title | smartify | strip_html | strip_newlines | escape_once %}
45
+ {% assign seo_page_title = seo_page_title | smartify | strip_html | normalize_whitespace | escape_once %}
50
46
  {% endif %}
51
47
 
52
48
  {% assign seo_description = page.description | default: page.excerpt | default: site.description %}
53
49
  {% if seo_description %}
54
- {% assign seo_description = seo_description | markdownify | strip_html | strip_newlines | escape_once %}
50
+ {% assign seo_description = seo_description | markdownify | strip_html | normalize_whitespace | escape_once %}
55
51
  {% endif %}
56
52
 
57
53
  {% assign seo_author = page.author | default: page.authors[0] | default: site.author %}
@@ -87,7 +83,7 @@
87
83
  {% if site.logo %}
88
84
  {% assign seo_site_logo = site.logo %}
89
85
  {% unless seo_site_logo contains "://" %}
90
- {% assign seo_site_logo = seo_site_logo | prepend: seo_url %}
86
+ {% assign seo_site_logo = seo_site_logo | absolute_url %}
91
87
  {% endunless %}
92
88
  {% assign seo_site_logo = seo_site_logo | escape %}
93
89
  {% endif %}
@@ -95,7 +91,7 @@
95
91
  {% if page.image %}
96
92
  {% assign seo_page_image = page.image.path | default: page.image.facebook | default: page.image %}
97
93
  {% unless seo_page_image contains "://" %}
98
- {% assign seo_page_image = seo_page_image | prepend: seo_url %}
94
+ {% assign seo_page_image = seo_page_image | absolute_url %}
99
95
  {% endunless %}
100
96
  {% assign seo_page_image = seo_page_image | escape %}
101
97
  {% endif %}
@@ -113,9 +109,9 @@
113
109
  <meta property="og:description" content="{{ seo_description }}" />
114
110
  {% endif %}
115
111
 
116
- {% if seo_url %}
117
- <link rel="canonical" href="{{ page.url | prepend: seo_url | replace:'/index.html','/' }}" />
118
- <meta property="og:url" content="{{ page.url | prepend: seo_url | replace:'/index.html','/' }}" />
112
+ {% if page.url %}
113
+ <link rel="canonical" href="{{ page.url | replace:'/index.html','/' | absolute_url }}" />
114
+ <meta property="og:url" content="{{ page.url | replace:'/index.html','/' | absolute_url }}" />
119
115
  {% endif %}
120
116
 
121
117
  {% if seo_site_title %}
@@ -133,7 +129,7 @@
133
129
  {% endif %}
134
130
 
135
131
  {% if page.image.twitter %}
136
- <meta name="twitter:image" content="{{ page.image.twitter | prepend: seo_url | escape }}" />
132
+ <meta name="twitter:image" content="{{ page.image.twitter | absolute_url }}" />
137
133
  {% endif %}
138
134
 
139
135
  {% if page.date %}
@@ -142,10 +138,10 @@
142
138
  {% endif %}
143
139
 
144
140
  {% if paginator.previous_page %}
145
- <link rel="prev" href="{{ paginator.previous_page_path | prepend: seo_url }}">
141
+ <link rel="prev" href="{{ paginator.previous_page_path | absolute_url }}">
146
142
  {% endif %}
147
143
  {% if paginator.next_page %}
148
- <link rel="next" href="{{ paginator.next_page_path | prepend: seo_url }}">
144
+ <link rel="next" href="{{ paginator.next_page_path | absolute_url }}">
149
145
  {% endif %}
150
146
 
151
147
  {% if site.twitter %}
@@ -209,14 +205,20 @@
209
205
  {% endif %}
210
206
 
211
207
  {% if seo_site_logo %}
212
- "logo": {{ seo_site_logo | jsonify }},
208
+ "publisher": {
209
+ "@type": "Organization",
210
+ "logo": {
211
+ "@type": "ImageObject",
212
+ "url": {{ seo_site_logo | jsonify }}
213
+ }
214
+ },
213
215
  {% endif %}
214
216
 
215
217
  {% if seo_links %}
216
218
  "sameAs": {{ seo_links | jsonify }},
217
219
  {% endif %}
218
220
 
219
- "url": {{ page.url | prepend: seo_url | replace:'/index.html','/' | jsonify }}
221
+ "url": {{ page.url | replace:'/index.html','/' | absolute_url | jsonify }}
220
222
  }
221
223
  </script>
222
224
 
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.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Balter
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-31 00:00:00.000000000 Z
11
+ date: 2016-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.1'
19
+ version: '3.3'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '3.1'
26
+ version: '3.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -106,12 +106,12 @@ files:
106
106
  - ".rubocop.yml"
107
107
  - ".travis.yml"
108
108
  - Gemfile
109
+ - History.markdown
109
110
  - LICENSE.txt
110
111
  - README.md
111
112
  - Rakefile
112
113
  - jekyll-seo-tag.gemspec
113
114
  - lib/jekyll-seo-tag.rb
114
- - lib/jekyll-seo-tag/filters.rb
115
115
  - lib/jekyll-seo-tag/version.rb
116
116
  - lib/template.html
117
117
  - script/bootstrap
@@ -138,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  version: '0'
139
139
  requirements: []
140
140
  rubyforge_project:
141
- rubygems_version: 2.6.4
141
+ rubygems_version: 2.6.8
142
142
  signing_key:
143
143
  specification_version: 4
144
144
  summary: A Jekyll plugin to add metadata tags for search engines and social networks
@@ -1,13 +0,0 @@
1
- module JekyllSeoTag
2
- module Filters
3
- # This is available in Liquid from version 3 which is required by Jekyll 3
4
- # Provided here for compatibility with Jekyll 2.x
5
- def default(input, default_value = ''.freeze)
6
- if !input || input.respond_to?(:empty?) && input.empty?
7
- default_value
8
- else
9
- input
10
- end
11
- end
12
- end
13
- end