jekyll-seo-tag 1.0.0 → 1.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: c9c2e7b63d04d2bde4d1f47a71849d7b7efc5b99
4
- data.tar.gz: 85705921fa8691e6588ffa10953f7cfc2ed31f3f
3
+ metadata.gz: f841664e9807e1d76d4ce51846a5f3b7d3239457
4
+ data.tar.gz: 53aa91acd74b1e52119a51d484ced2c99da32587
5
5
  SHA512:
6
- metadata.gz: fb94e6867b9fcc64aa895e7330a18a8c5f8e46242f8acf5c5cf2928516bc4ae131174f1ec9523838e89c8f7f092f4fb11f8d19573deb4d42cd6c9cc2946ce7c5
7
- data.tar.gz: bf8b3125ab927e7d05abfadb4f00f43ae692504b4d9449adccc6df0eeda3ada48025d10cdd44e628cbc2b908f85d32dd634dc5841ac2cf87f4fb608f47a3b9ab
6
+ metadata.gz: 108c1ea4cdf5286e00d7727c0dcfd207021959f457117de75a33c012905f5cd3413ff87708fb6297a9171730f0c9592c6a52904bad8ff991da63aae5bb27a894
7
+ data.tar.gz: d4a22ada3a1311d1a8b1149dff77a2a0435d97a8db78431fc33a42819f777d763f5f7daddb70bc151a802aa16c35ed4f6a2a5a59eede963808f7d87f55bbfecf
@@ -0,0 +1,10 @@
1
+ Metrics/LineLength:
2
+ Exclude:
3
+ - spec/**/*
4
+ - jekyll-seo-tag.gemspec
5
+
6
+ Style/Documentation:
7
+ Enabled: false
8
+
9
+ Style/FileName:
10
+ Enabled: false
data/Gemfile CHANGED
@@ -1,6 +1,16 @@
1
1
  source 'https://rubygems.org'
2
+ require 'json'
3
+ require 'open-uri'
2
4
 
3
- # Specify your gem's dependencies in jekyll_seo_tags.gemspec
4
5
  gemspec
5
6
 
6
- gem 'github-pages'
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
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/benbalter/jekyll-seo-tag.svg)](https://travis-ci.org/benbalter/jekyll-seo-tag)
6
6
 
7
7
  ## What it does
8
8
 
@@ -53,17 +53,22 @@ The SEO tag will respect any of the following if included in your site's `_confi
53
53
  * `description` - A short description (e.g., A blog dedicated to reviewing cat gifs)
54
54
  * `url` - The full URL to your site. Note: `site.github.url` will be used by default.
55
55
  * `twitter:username` - The site's Twitter handle. You'll want to describe it like so:
56
-
57
56
  ```yml
58
57
  twitter:
59
58
  username: benbalter
60
59
  ```
61
-
60
+ * `facebook:app_id` (A Facebook app ID for Facebook insights), and/or `facebook:publisher` (A Facebook page URL or ID of the publishing entity). You'll want to describe one or both like so:
61
+ ```yml
62
+ facebook:
63
+ app_id: 1234
64
+ publisher: 1234
65
+ ```
62
66
  * `logo` - Relative URL to a site-wide logo (e.g., `assets/your-company-logo.png`)
63
67
  * `social` - For [specifying social profiles](https://developers.google.com/structured-data/customize/social-profiles). The following properties are available:
64
68
  * `type` - Either `person` or `organization` (defaults to `person`)
65
69
  * `name` - If the user or organization name differs from the site's name
66
70
  * `links` - An array of links to social media profiles.
71
+ * `google_site_verification` for verifying ownership via Google webmaster tools
67
72
 
68
73
  The SEO tag will respect the following YAML front matter if included in a post, page, or document:
69
74
 
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
@@ -4,31 +4,31 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'jekyll-seo-tag/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "jekyll-seo-tag"
7
+ spec.name = 'jekyll-seo-tag'
8
8
  spec.version = Jekyll::SeoTag::VERSION
9
- spec.authors = ["Ben Balter"]
10
- spec.email = ["ben.balter@github.com"]
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.}
12
- spec.homepage = "https://github.com/benbalter/jekyll-seo-tag"
13
- spec.license = "MIT"
9
+ spec.authors = ['Ben Balter']
10
+ spec.email = ['ben.balter@github.com']
11
+ spec.summary = "A Jekyll plugin to add metadata tags for search engines and social networks to better index and display your site's content."
12
+ spec.homepage = 'https://github.com/benbalter/jekyll-seo-tag'
13
+ spec.license = 'MIT'
14
14
 
15
15
  # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
16
16
  # delete this section to allow pushing this gem to any host.
17
17
  if spec.respond_to?(:metadata)
18
- spec.metadata['allowed_push_host'] = "https://rubygems.org"
18
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
19
19
  else
20
- raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
20
+ raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.'
21
21
  end
22
22
 
23
23
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
24
- spec.bindir = "exe"
24
+ spec.bindir = 'exe'
25
25
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
- spec.require_paths = ["lib"]
27
-
28
- spec.add_dependency "jekyll", ">= 2.0"
29
- spec.add_development_dependency "bundler", "~> 1.10"
30
- spec.add_development_dependency "rake", "~> 10.0"
31
- spec.add_development_dependency "rspec", "~> 3.3"
32
- spec.add_development_dependency "html-proofer", "~> 2.5"
26
+ spec.require_paths = ['lib']
33
27
 
28
+ spec.add_dependency 'jekyll', '>= 2.0'
29
+ spec.add_development_dependency 'bundler', '~> 1.10'
30
+ spec.add_development_dependency 'rake', '~> 10.0'
31
+ spec.add_development_dependency 'rspec', '~> 3.3'
32
+ spec.add_development_dependency 'html-proofer', '~> 2.5'
33
+ spec.add_development_dependency 'rubocop', '~> 0.37'
34
34
  end
@@ -2,9 +2,10 @@ require 'jekyll-seo-tag/filters'
2
2
 
3
3
  module Jekyll
4
4
  class SeoTag < Liquid::Tag
5
-
6
5
  attr_accessor :context
7
6
 
7
+ MINIFY_REGEX = /(>\n|[%}]})\s+(<|{[{%])/
8
+
8
9
  def render(context)
9
10
  @context = context
10
11
  output = template.render!(payload, info)
@@ -16,15 +17,15 @@ module Jekyll
16
17
 
17
18
  def payload
18
19
  {
19
- "page" => context.registers[:page],
20
- "site" => context.registers[:site].site_payload["site"]
20
+ 'page' => context.registers[:page],
21
+ 'site' => context.registers[:site].site_payload['site']
21
22
  }
22
23
  end
23
24
 
24
25
  def info
25
26
  {
26
- :registers => context.registers,
27
- :filters => [Jekyll::Filters, JekyllSeoTag::Filters]
27
+ registers: context.registers,
28
+ filters: [Jekyll::Filters, JekyllSeoTag::Filters]
28
29
  }
29
30
  end
30
31
 
@@ -33,11 +34,15 @@ module Jekyll
33
34
  end
34
35
 
35
36
  def template_contents
36
- @template_contents ||= File.read(template_path).gsub(/(>\n|[%}]})\s+(<|{[{%])/,'\1\2').chomp
37
+ @template_contents ||= begin
38
+ File.read(template_path).gsub(MINIFY_REGEX, '\1\2').chomp
39
+ end
37
40
  end
38
41
 
39
42
  def template_path
40
- @template_path ||= File.expand_path "./template.html", File.dirname(__FILE__)
43
+ @template_path ||= begin
44
+ File.expand_path './template.html', File.dirname(__FILE__)
45
+ end
41
46
  end
42
47
  end
43
48
  end
@@ -1,6 +1,5 @@
1
1
  module JekyllSeoTag
2
2
  module Filters
3
-
4
3
  # This is available in Liquid from version 3 which is required by Jekyll 3
5
4
  # Provided here for compatibility with Jekyll 2.x
6
5
  def default(input, default_value = ''.freeze)
@@ -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.0.0"
6
+ VERSION = '1.1.0'.freeze
7
7
  end
8
8
  end
@@ -4,28 +4,32 @@
4
4
  {% assign seo_url = site.url | append: site.baseurl %}
5
5
  {% endif %}
6
6
  {% assign seo_url = seo_url | default: site.github.url %}
7
-
8
7
  {% assign seo_site_title = site.title | default: site.name %}
9
8
 
10
9
  {% if page.title %}
11
10
  {% assign seo_title = page.title %}
12
11
  {% assign seo_page_title = page.title %}
12
+
13
13
  {% if seo_site_title %}
14
14
  {% assign seo_title = seo_title | append:" - " | append: seo_site_title %}
15
15
  {% endif %}
16
16
  {% elsif seo_site_title %}
17
17
  {% assign seo_title = seo_site_title %}
18
18
  {% assign seo_page_title = seo_site_title %}
19
+
19
20
  {% if site.description %}
20
21
  {% assign seo_title = seo_title | append:" - " | append: site.description %}
21
22
  {% endif %}
22
23
  {% endif %}
24
+
23
25
  {% if seo_title %}
24
26
  {% assign seo_title = seo_title | markdownify | strip_html | strip_newlines | escape_once %}
25
27
  {% endif %}
28
+
26
29
  {% if seo_site_title %}
27
30
  {% assign seo_site_title = seo_site_title | markdownify | strip_html | strip_newlines | escape_once %}
28
31
  {% endif %}
32
+
29
33
  {% if seo_page_title %}
30
34
  {% assign seo_page_title = seo_page_title | markdownify | strip_html | strip_newlines | escape_once %}
31
35
  {% endif %}
@@ -39,6 +43,7 @@
39
43
  {% assign seo_author_name = page.author.name | default: page.author %}
40
44
  {% assign seo_author_twitter = page.author.twitter | default: page.author %}
41
45
  {% endif %}
46
+
42
47
  {% if seo_author_twitter %}
43
48
  {% assign seo_author_twitter = seo_author_twitter | replace:"@","" | prepend:"@" %}
44
49
  {% endif %}
@@ -79,12 +84,16 @@
79
84
 
80
85
  {% if page.date %}
81
86
  <meta property="og:type" content="article" />
87
+ <meta property="article:published_time" content="{{ page.date | date_to_xmlschema }}" />
88
+
82
89
  {% if page.next.url %}
83
90
  <link rel="next" href="{{ page.next.url | prepend: seo_url | replace:'/index.html','/' }}" title="{{ page.next.title | escape }}" />
84
91
  {% endif %}
92
+
85
93
  {% if page.previous.url %}
86
94
  <link rel="prev" href="{{ page.previous.url | prepend: seo_url | replace:'/index.html','/' }}" title="{{ page.previous.title | escape }}" />
87
95
  {% endif %}
96
+
88
97
  <script type="application/ld+json">
89
98
  {
90
99
  "@context": "http://schema.org",
@@ -102,14 +111,25 @@
102
111
  <meta name="twitter:site" content="@{{ site.twitter.username | replace:"@","" }}" />
103
112
  <meta name="twitter:title" content="{{ seo_title }}" />
104
113
  <meta name="twitter:description" content="{{ seo_description }}" />
114
+
105
115
  {% if page.image %}
106
116
  <meta name="twitter:image" content="{{ page.image | escape }}" />
107
117
  {% endif %}
118
+
108
119
  {% if seo_author_twitter %}
109
120
  <meta name="twitter:creator" content="{{ seo_author_twitter }}" />
110
121
  {% endif %}
111
122
  {% endif %}
112
123
 
124
+ {% if site.facebook %}
125
+ <meta property="article:publisher" content="{{ site.facebook.publisher }}" />
126
+ <meta property="fb:app_id" content="{{ site.facebook.app_id }}" />
127
+ {% endif %}
128
+
129
+ {% if site.google_site_verification %}
130
+ <meta name="google-site-verification" content="{{ site.google_site_verification }}" />
131
+ {% endif %}
132
+
113
133
  {% if site.logo %}
114
134
  <script type="application/ld+json">
115
135
  {
@@ -3,4 +3,5 @@
3
3
  set -ex
4
4
 
5
5
  bundle exec rake spec
6
+ bundle exec rubocop -S -D
6
7
  bundle exec gem build jekyll-seo-tag.gemspec
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: 1.0.0
4
+ version: 1.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-02-03 00:00:00.000000000 Z
11
+ date: 2016-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '2.5'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.37'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.37'
83
97
  description:
84
98
  email:
85
99
  - ben.balter@github.com
@@ -89,6 +103,7 @@ extra_rdoc_files: []
89
103
  files:
90
104
  - ".gitignore"
91
105
  - ".rspec"
106
+ - ".rubocop.yml"
92
107
  - ".travis.yml"
93
108
  - Gemfile
94
109
  - LICENSE.txt
@@ -123,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
138
  version: '0'
124
139
  requirements: []
125
140
  rubyforge_project:
126
- rubygems_version: 2.5.1
141
+ rubygems_version: 2.5.2
127
142
  signing_key:
128
143
  specification_version: 4
129
144
  summary: A Jekyll plugin to add metadata tags for search engines and social networks