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 +4 -4
- data/.rubocop.yml +7 -0
- data/.travis.yml +1 -1
- data/Gemfile +1 -0
- data/History.markdown +23 -0
- data/README.md +28 -1
- data/jekyll-seo-tag.gemspec +1 -1
- data/lib/jekyll-seo-tag.rb +23 -15
- data/lib/jekyll-seo-tag/version.rb +1 -1
- data/lib/template.html +21 -19
- metadata +6 -6
- data/lib/jekyll-seo-tag/filters.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07d7b830b127017c667a9e58bd5c214e594558bc
|
4
|
+
data.tar.gz: a69f4f9cee9f45644add22a57245366cdbc1ddc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52c022b593902ef22131b0e96ef497d188e73469a07a6c2ffa33c0619de08393eeeaae729556a8d368a1d45b0d9ce7907f64e1eb40a177abcbce1213989e82b6
|
7
|
+
data.tar.gz: 0a7309abed4b88e3c9b95a8f349cfae6ad0305b304a4901d3fcf7e1c4d637a16d6381a3b2fd6fe64eba7f9d2817d8d410a23a3700b7fb36fb20f0cb655be3677
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
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
|
data/History.markdown
ADDED
@@ -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
|
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.
|
data/jekyll-seo-tag.gemspec
CHANGED
@@ -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.
|
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'
|
data/lib/jekyll-seo-tag.rb
CHANGED
@@ -1,11 +1,19 @@
|
|
1
|
-
require
|
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
|
-
|
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
|
-
|
25
|
-
|
32
|
+
"version" => Jekyll::SeoTag::VERSION,
|
33
|
+
"title" => title?
|
26
34
|
}
|
27
35
|
end
|
28
36
|
|
29
37
|
def payload
|
30
38
|
{
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
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 =~
|
47
|
+
!(@text =~ %r!title=false!i)
|
40
48
|
end
|
41
49
|
|
42
50
|
def info
|
43
51
|
{
|
44
|
-
registers
|
45
|
-
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,
|
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
|
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(
|
75
|
+
Liquid::Template.register_tag("seo", Jekyll::SeoTag)
|
data/lib/template.html
CHANGED
@@ -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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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
|
117
|
-
<link rel="canonical" href="{{ page.url |
|
118
|
-
<meta property="og:url" content="{{ page.url |
|
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 |
|
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 |
|
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 |
|
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
|
-
"
|
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 |
|
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.
|
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-
|
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.
|
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.
|
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.
|
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
|