jekyll-seo-tag 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/jekyll-seo-tag.gemspec +2 -1
- data/lib/jekyll-seo-tag.rb +8 -6
- data/lib/jekyll-seo-tag/version.rb +8 -0
- data/lib/template.html +14 -6
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ddb197372851982ae0bb4ab3b2bbb0c08e29dc70
|
4
|
+
data.tar.gz: f238e1379de659c6100b7bfc7f2b9362aff6061a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 990e391cc4f3ff9a354be4ea164746cea7bfce7eda85b0565ca6ed1ea84f11970ab7ef9b969e9de1adf645cd7e5e5dc4b4a59056cc76afcbfe717478fa412d58
|
7
|
+
data.tar.gz: ec56d87c8c74267c174dafbf012c7233657ef95a9e210ba5ef558a0eedbac23b3dddae7b2dca197fcc5178ea9aa9f088ab3385c09e060abbe707769fea752fa0
|
data/jekyll-seo-tag.gemspec
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'jekyll-seo-tag/version'
|
4
5
|
|
5
6
|
Gem::Specification.new do |spec|
|
6
7
|
spec.name = "jekyll-seo-tag"
|
7
|
-
spec.version =
|
8
|
+
spec.version = Jekyll::SeoTag::VERSION
|
8
9
|
spec.authors = ["Ben Balter"]
|
9
10
|
spec.email = ["ben.balter@github.com"]
|
10
11
|
spec.summary = %q{A Jekyll plugin to add metadata tags for search engines and social networks to better index and display your site's content.}
|
data/lib/jekyll-seo-tag.rb
CHANGED
@@ -3,16 +3,18 @@ module Jekyll
|
|
3
3
|
|
4
4
|
attr_accessor :context
|
5
5
|
|
6
|
+
HTML_ESCAPE = {
|
7
|
+
"\u201c".freeze => '“'.freeze,
|
8
|
+
"\u201d".freeze => '”'.freeze
|
9
|
+
}
|
10
|
+
HTML_ESCAPE_REGEX = Regexp.union(HTML_ESCAPE.keys).freeze
|
11
|
+
|
6
12
|
def render(context)
|
7
13
|
@context = context
|
8
14
|
output = Liquid::Template.parse(template_contents).render!(payload, info)
|
9
15
|
|
10
|
-
# Minify
|
11
|
-
output.gsub!(/[\s]{2,}/, "\n")
|
12
|
-
|
13
16
|
# Encode smart quotes. See https://github.com/benbalter/jekyll-seo-tag/pull/6
|
14
|
-
output.gsub!(
|
15
|
-
output.gsub!("\u201d", "”")
|
17
|
+
output.gsub!(HTML_ESCAPE_REGEX, HTML_ESCAPE)
|
16
18
|
|
17
19
|
output
|
18
20
|
end
|
@@ -34,7 +36,7 @@ module Jekyll
|
|
34
36
|
end
|
35
37
|
|
36
38
|
def template_contents
|
37
|
-
@template_contents ||= File.read(template_path)
|
39
|
+
@template_contents ||= File.read(template_path).gsub(/(>\n|[%}]})\s+(<|{[{%])/,'\1\2').chomp
|
38
40
|
end
|
39
41
|
|
40
42
|
def template_path
|
data/lib/template.html
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
<!-- Begin Jekyll SEO tag -->
|
2
2
|
|
3
3
|
{% if site.url %}
|
4
|
-
{% assign seo_url = site.url %}
|
4
|
+
{% assign seo_url = site.url | append: site.baseurl %}
|
5
5
|
{% elsif site.github.url %}
|
6
6
|
{% assign seo_url = site.github.url %}
|
7
7
|
{% endif %}
|
8
8
|
|
9
9
|
{% if page.title %}
|
10
10
|
{% assign seo_title = page.title %}
|
11
|
+
{% assign seo_page_title = page.title %}
|
11
12
|
{% if site.title %}
|
12
13
|
{% assign seo_title = seo_title | append:" - " | append: site.title %}
|
13
14
|
{% endif %}
|
14
15
|
{% elsif site.title %}
|
15
16
|
{% assign seo_title = site.title %}
|
17
|
+
{% assign seo_page_title = site.title %}
|
16
18
|
{% if site.description %}
|
17
19
|
{% assign seo_title = seo_title | append:" - " | append: site.description %}
|
18
20
|
{% endif %}
|
@@ -20,6 +22,9 @@
|
|
20
22
|
{% if seo_title %}
|
21
23
|
{% assign seo_title = seo_title | markdownify | strip_html | strip_newlines | escape_once %}
|
22
24
|
{% endif %}
|
25
|
+
{% if seo_page_title %}
|
26
|
+
{% assign seo_page_title = seo_page_title | markdownify | strip_html | strip_newlines | escape_once %}
|
27
|
+
{% endif %}
|
23
28
|
|
24
29
|
{% if page.description %}
|
25
30
|
{% assign seo_description = page.description %}
|
@@ -32,7 +37,10 @@
|
|
32
37
|
|
33
38
|
{% if seo_title %}
|
34
39
|
<title>{{ seo_title }}</title>
|
35
|
-
|
40
|
+
{% endif %}
|
41
|
+
|
42
|
+
{% if seo_title %}
|
43
|
+
<meta property="og:title" content="{{ seo_page_title }}" />
|
36
44
|
{% endif %}
|
37
45
|
|
38
46
|
{% if seo_description %}
|
@@ -41,8 +49,8 @@
|
|
41
49
|
{% endif %}
|
42
50
|
|
43
51
|
{% if seo_url %}
|
44
|
-
<link rel="canonical" href="{{ seo_url
|
45
|
-
<meta property='og:url' content='{{ seo_url
|
52
|
+
<link rel="canonical" href="{{ page.url | prepend: seo_url | replace:'/index.html','/' }}" itemprop="url" />
|
53
|
+
<meta property='og:url' content='{{ page.url | prepend: seo_url | replace:'/index.html','/' }}' />
|
46
54
|
{% endif %}
|
47
55
|
|
48
56
|
{% if site.title %}
|
@@ -64,10 +72,10 @@
|
|
64
72
|
{% if page.date %}
|
65
73
|
<meta property="og:type" content="article" />
|
66
74
|
{% if page.next.url %}
|
67
|
-
<link rel="next" href="{{
|
75
|
+
<link rel="next" href="{{ page.next.url | prepend: seo_url | replace:'/index.html','/' }}" title="{{ page.next.title | escape }}" />
|
68
76
|
{% endif %}
|
69
77
|
{% if page.previous.url %}
|
70
|
-
<link rel="prev" href="{{
|
78
|
+
<link rel="prev" href="{{ page.previous.url | prepend: seo_url | replace:'/index.html','/' }}" title="{{ page.previous.title | escape }}" />
|
71
79
|
{% endif %}
|
72
80
|
<script type="application/ld+json">
|
73
81
|
{
|
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: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Balter
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -96,6 +96,7 @@ files:
|
|
96
96
|
- Rakefile
|
97
97
|
- jekyll-seo-tag.gemspec
|
98
98
|
- lib/jekyll-seo-tag.rb
|
99
|
+
- lib/jekyll-seo-tag/version.rb
|
99
100
|
- lib/template.html
|
100
101
|
- script/bootstrap
|
101
102
|
- script/cibuild
|
@@ -121,10 +122,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
122
|
version: '0'
|
122
123
|
requirements: []
|
123
124
|
rubyforge_project:
|
124
|
-
rubygems_version: 2.5.
|
125
|
+
rubygems_version: 2.5.1
|
125
126
|
signing_key:
|
126
127
|
specification_version: 4
|
127
128
|
summary: A Jekyll plugin to add metadata tags for search engines and social networks
|
128
129
|
to better index and display your site's content.
|
129
130
|
test_files: []
|
130
|
-
has_rdoc:
|