jekyll-seo-tag 1.2.0 → 1.3.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: 24b1466116c0edcefb7df6ea675eca5d08735626
4
- data.tar.gz: 3effdcadd767625bd1418d1f3c0d36a3b50c7a13
3
+ metadata.gz: 47b91477d72c6610b032ad8cadf43ac8d7a99adf
4
+ data.tar.gz: 39acdc6de64b4bbff5a9668f9c0e75e557805608
5
5
  SHA512:
6
- metadata.gz: f39e1738e4cdaab1fe7aa0fe139f6fba9fa2479dcb0a0d5167d5132f444e3eae04d0afff321cb58c1f93b5bf666cd9d94c250c73b7779ca7d3f68021882b4007
7
- data.tar.gz: a3888cf97e85b7a66461a225d68e54048a95caeaa039dbb9f3c9e74a18113f5fa46210650f5f251414c7f5a0e6a985d429ef2621f8e671b7b9b50ffcb808fd5f
6
+ metadata.gz: f18064aed325e3cb07f62ccd71e4c32d60afb6188bd48591b8160fda3b586d7a39e285c3d55b0c6ea1fd22bca86abfcbeeb7f4f3f96abc1d4952221865209f2b
7
+ data.tar.gz: 55e8a20c1e70d7fd30616cb70cdd035beac6dd59a849d0215390de9b3d72a6f0698d760660b0b4af00fd79d26fd1925cf02efbfdbdf22c113df1953a3956026c
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  A Jekyll plugin to add metadata tags for search engines and social networks to better index and display your site's content.
4
4
 
5
- [![Gem Version](https://badge.fury.io/rb/jekyll-seo-tag.svg)](https://badge.fury.io/rb/jekyll-seo-tag) [![Build Status](https://travis-ci.org/benbalter/jekyll-seo-tag.svg)](https://travis-ci.org/benbalter/jekyll-seo-tag)
5
+ [![Gem Version](https://badge.fury.io/rb/jekyll-seo-tag.svg)](https://badge.fury.io/rb/jekyll-seo-tag) [![Build Status](https://travis-ci.org/jekyll/jekyll-seo-tag.svg)](https://travis-ci.org/jekyll/jekyll-seo-tag)
6
6
 
7
7
  ## What it does
8
8
 
@@ -68,9 +68,8 @@ The SEO tag will respect any of the following if included in your site's `_confi
68
68
  publisher: 1234
69
69
  ```
70
70
 
71
- * `logo` - Relative URL to a site-wide logo (e.g., `assets/your-company-logo.png`)
71
+ * `logo` - Relative URL to a site-wide logo (e.g., `/assets/your-company-logo.png`)
72
72
  * `social` - For [specifying social profiles](https://developers.google.com/structured-data/customize/social-profiles). The following properties are available:
73
- * `type` - Either `person` or `organization` (defaults to `person`)
74
73
  * `name` - If the user or organization name differs from the site's name
75
74
  * `links` - An array of links to social media profiles.
76
75
  * `google_site_verification` for verifying ownership via Google webmaster tools
@@ -79,7 +78,7 @@ The SEO tag will respect the following YAML front matter if included in a post,
79
78
 
80
79
  * `title` - The title of the post, page, or document
81
80
  * `description` - A short description of the page's content
82
- * `image` - Relative URL to an image associated with the post, page, or document (e.g., `assets/page-pic.jpg`)
81
+ * `image` - Relative URL to an image associated with the post, page, or document (e.g., `/assets/page-pic.jpg`)
83
82
  * `author` - Page-, post-, or document-specific author information (see below)
84
83
 
85
84
  ### Disabling `<title>` output
@@ -145,3 +144,12 @@ There are several ways to convey this author-specific information. Author inform
145
144
  ```yml
146
145
  author: benbalter
147
146
  ```
147
+
148
+ ### Customizing JSON-LD output
149
+
150
+ The following options can be set for any particular page. While the default options are meant to serve most users in the most common circumstances, there may be situations where more precise control is necessary.
151
+
152
+ * `seo`
153
+ * `name` - If the name of the thing that the page represents is different from the page title. (i.e.: "Frank's Café" vs "Welcome to Frank's Café")
154
+ * `type` - The type of things that the page represents. This must be a [Schema.org type](http://schema.org/docs/schemas.html), and will probably usually be something like [`BlogPosting`](http://schema.org/BlogPosting), [`NewsArticle`](http://schema.org/NewsArticle), [`Person`](http://schema.org/Person), [`Organization`](http://schema.org/Organization), etc.
155
+ * `links` - An array of other URLs that represent the same thing that this page represents. For instance, Jane's bio page might include links to Jane's GitHub and Twitter profiles.
@@ -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', '>= 2.0'
28
+ spec.add_dependency 'jekyll', '~> 3.0'
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'
@@ -20,7 +20,7 @@ module Jekyll
20
20
 
21
21
  def options
22
22
  {
23
- 'version' => VERSION,
23
+ 'version' => Jekyll::SeoTag::VERSION,
24
24
  'title' => title?
25
25
  }
26
26
  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 = '1.2.0'.freeze
6
+ VERSION = '1.3.0'.freeze
7
7
  end
8
8
  end
data/lib/template.html CHANGED
@@ -1,5 +1,9 @@
1
1
  <!-- Begin Jekyll SEO tag v{{ seo_tag.version }} -->
2
2
 
3
+ {% if page.url == "/" or page.url == "/about/" %}
4
+ {% assign seo_homepage_or_about = true %}
5
+ {% endif %}
6
+
3
7
  {% if site.url %}
4
8
  {% assign seo_url = site.url | append: site.baseurl %}
5
9
  {% endif %}
@@ -22,6 +26,17 @@
22
26
  {% endif %}
23
27
  {% endif %}
24
28
 
29
+ {% if page.seo and page.seo.name %}
30
+ {% assign seo_name = page.seo.name %}
31
+ {% elsif seo_homepage_or_about and site.social and site.social.name %}
32
+ {% assign seo_name = site.social.name %}
33
+ {% elsif seo_homepage_or_about and seo_site_title %}
34
+ {% assign seo_name = seo_site_title %}
35
+ {% endif %}
36
+ {% if seo_name %}
37
+ {% assign seo_name = seo_name | markdownify | strip_html | strip_newlines | escape_once %}
38
+ {% endif %}
39
+
25
40
  {% if seo_title %}
26
41
  {% assign seo_title = seo_title | markdownify | strip_html | strip_newlines | escape_once %}
27
42
  {% endif %}
@@ -53,6 +68,22 @@
53
68
  {% assign seo_author_twitter = seo_author_twitter | replace:"@","" %}
54
69
  {% endif %}
55
70
 
71
+ {% if page.seo and page.seo.type %}
72
+ {% assign seo_type = page.seo.type %}
73
+ {% elsif seo_homepage_or_about %}
74
+ {% assign seo_type = "WebSite" %}
75
+ {% elsif page.date %}
76
+ {% assign seo_type = "BlogPosting" %}
77
+ {% else %}
78
+ {% assign seo_type = "WebPage" %}
79
+ {% endif %}
80
+
81
+ {% if page.seo and page.seo.links %}
82
+ {% assign seo_links = page.seo.links %}
83
+ {% elsif seo_homepage_or_about and site.social and site.social.links %}
84
+ {% assign seo_links = site.social.links %}
85
+ {% endif %}
86
+
56
87
  {% if seo_tag.title and seo_title %}
57
88
  <title>{{ seo_title }}</title>
58
89
  {% endif %}
@@ -73,18 +104,10 @@
73
104
 
74
105
  {% if seo_site_title %}
75
106
  <meta property="og:site_name" content="{{ seo_site_title }}" />
76
- <script type="application/ld+json">
77
- {
78
- "@context" : "http://schema.org",
79
- "@type" : "WebSite",
80
- "name" : {{ seo_site_title | jsonify }},
81
- "url" : {{ seo_url | jsonify }}
82
- }
83
- </script>
84
107
  {% endif %}
85
108
 
86
109
  {% if page.image %}
87
- <meta property="og:image" content="{{ page.image | prepend: "/" | prepend: seo_url | escape }}" />
110
+ <meta property="og:image" content="{{ page.image | prepend: seo_url | escape }}" />
88
111
  {% endif %}
89
112
 
90
113
  {% if page.date %}
@@ -98,17 +121,6 @@
98
121
  {% if page.previous.url %}
99
122
  <link rel="prev" href="{{ page.previous.url | prepend: seo_url | replace:'/index.html','/' }}" title="{{ page.previous.title | escape }}" />
100
123
  {% endif %}
101
-
102
- <script type="application/ld+json">
103
- {
104
- "@context": "http://schema.org",
105
- "@type": "NewsArticle",
106
- "headline": {{ page.title | jsonify }},
107
- "image": {{ page.image | jsonify }},
108
- "datePublished": {{ page.date | date_to_xmlschema | jsonify }},
109
- "description": {{ seo_description | jsonify }}
110
- }
111
- </script>
112
124
  {% endif %}
113
125
 
114
126
  {% if site.twitter %}
@@ -118,7 +130,7 @@
118
130
  <meta name="twitter:description" content="{{ seo_description }}" />
119
131
 
120
132
  {% if page.image %}
121
- <meta name="twitter:image" content="{{ page.image | escape }}" />
133
+ <meta name="twitter:image" content="{{ page.image | prepend: seo_url | escape }}" />
122
134
  {% endif %}
123
135
 
124
136
  {% if seo_author_twitter %}
@@ -127,35 +139,57 @@
127
139
  {% endif %}
128
140
 
129
141
  {% if site.facebook %}
130
- <meta property="article:publisher" content="{{ site.facebook.publisher }}" />
131
- <meta property="fb:app_id" content="{{ site.facebook.app_id }}" />
142
+ {% if site.facebook.publisher %}
143
+ <meta property="article:publisher" content="{{ site.facebook.publisher }}" />
144
+ {% endif %}
145
+
146
+ {% if site.facebook.app_id %}
147
+ <meta property="fb:app_id" content="{{ site.facebook.app_id }}" />
148
+ {% endif %}
132
149
  {% endif %}
133
150
 
134
151
  {% if site.google_site_verification %}
135
152
  <meta name="google-site-verification" content="{{ site.google_site_verification }}" />
136
153
  {% endif %}
137
154
 
155
+ <script type="application/ld+json">
156
+ {
157
+ "@context" : "http://schema.org",
158
+
159
+ {% if seo_type %}
160
+ "@type" : {{ seo_type | jsonify }},
161
+ {% endif %}
162
+
163
+ {% if seo_name %}
164
+ "name" : {{ seo_name | jsonify }},
165
+ {% endif %}
166
+
167
+ {% if seo_page_title %}
168
+ "headline": {{ seo_page_title | jsonify }},
169
+ {% endif %}
170
+
171
+ {% if page.image %}
172
+ "image": {{ page.image | jsonify }},
173
+ {% endif %}
174
+
175
+ {% if page.date %}
176
+ "datePublished": {{ page.date | date_to_xmlschema | jsonify }},
177
+ {% endif %}
178
+
179
+ {% if seo_description %}
180
+ "description": {{ seo_description | jsonify }},
181
+ {% endif %}
182
+
138
183
  {% if site.logo %}
139
- <script type="application/ld+json">
140
- {
141
- "@context": "http://schema.org",
142
- "@type": "Organization",
143
- "url": {{ seo_url | jsonify }},
144
- "logo": {{ site.logo | prepend: "/" | prepend: seo_url | jsonify }}
145
- }
146
- </script>
147
- {% endif %}
148
-
149
- {% if site.social %}
150
- <script type="application/ld+json">
151
- {
152
- "@context" : "http://schema.org",
153
- "@type" : "{% if site.social.type %}{{ site.social.type }}{% else %}person{% endif %}",
154
- "name" : "{% if site.social.name %}{{ site.social.name }}{% else %}{{ seo_site_title }}{% endif %}",
155
- "url" : {{ seo_url | jsonify }},
156
- "sameAs" : {{ site.social.links | jsonify }}
157
- }
158
- </script>
184
+ "logo": {{ site.logo | prepend: "/" | prepend: seo_url | jsonify }},
185
+ {% endif %}
186
+
187
+ {% if seo_links %}
188
+ "sameAs" : {{ seo_links | jsonify }},
159
189
  {% endif %}
160
190
 
191
+ "url" : "{{ page.url | prepend: seo_url | replace:'/index.html','/' }}"
192
+ }
193
+ </script>
194
+
161
195
  <!-- End Jekyll SEO tag -->
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-seo-tag
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.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-02-21 00:00:00.000000000 Z
11
+ date: 2016-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.0'
19
+ version: '3.0'
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: '2.0'
26
+ version: '3.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement