jekyll-seo-tag-yx 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/.rubocop.yml +10 -0
- data/.travis.yml +7 -0
- data/Gemfile +16 -0
- data/LICENSE.txt +21 -0
- data/README.md +189 -0
- data/Rakefile +6 -0
- data/jekyll-seo-tag.gemspec +34 -0
- data/lib/jekyll-seo-tag.rb +67 -0
- data/lib/jekyll-seo-tag/filters.rb +13 -0
- data/lib/jekyll-seo-tag/version.rb +8 -0
- data/lib/template.html +223 -0
- data/script/bootstrap +5 -0
- data/script/cibuild +7 -0
- data/script/release +38 -0
- metadata +147 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2aaea47ba18041259ea889d7f9fe5ae2d904c806
|
4
|
+
data.tar.gz: 2d2dc8b1718858d9de6b80b978ab5e16c07b4933
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fbd95888ced7acbf8ba748fa40039f586db6ffa31daa42b5fde859f3b5bd2377e3abc4e84d6620e3db8b84fd1f9f8fc2b271eb0d50c0f338835da331b0a3977a
|
7
|
+
data.tar.gz: 11a6c31288737db06556eab61b817f2f4ead07e3f9effe0c883f2e69f12dd616afa07750be45a77b9c0432540485248657c2b53e8b9952b7c39514a5c0a8deff
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
require 'json'
|
3
|
+
require 'open-uri'
|
4
|
+
|
5
|
+
gemspec
|
6
|
+
|
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/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Ben Balter
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,189 @@
|
|
1
|
+
# Jekyll SEO Tag
|
2
|
+
|
3
|
+
A Jekyll plugin to add metadata tags for search engines and social networks to better index and display your site's content.
|
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/jekyll/jekyll-seo-tag.svg)](https://travis-ci.org/jekyll/jekyll-seo-tag)
|
6
|
+
|
7
|
+
## What it does
|
8
|
+
|
9
|
+
Jekyll SEO Tag adds the following meta tags to your site:
|
10
|
+
|
11
|
+
* Pages title (with site title appended when available)
|
12
|
+
* Page description
|
13
|
+
* Canonical URL
|
14
|
+
* Next and previous URLs on paginated pages
|
15
|
+
* [JSON-LD Site and post metadata](https://developers.google.com/structured-data/) for richer indexing
|
16
|
+
* [Open graph](http://ogp.me/) title, description, site title, and URL (for Facebook, LinkedIn, etc.)
|
17
|
+
* [Twitter summary card](https://dev.twitter.com/cards/overview) metadata
|
18
|
+
|
19
|
+
While you could theoretically add the necessary metadata tags yourself, Jekyll SEO Tag provides a battle-tested template of crowdsourced best-practices.
|
20
|
+
|
21
|
+
## What it doesn't do
|
22
|
+
|
23
|
+
Jekyll SEO tag is designed to output machine-readable metadata for search engines and social networks to index and display. If you're looking for something to analyze your Jekyll site's structure and content (e.g., more traditional SEO optimization), take a look at [The Jekyll SEO Gem](https://github.com/pmarsceill/jekyll-seo-gem).
|
24
|
+
|
25
|
+
Jekyll SEO tag isn't designed to accommodate every possible use case. It should work for most site out of the box and without a laundry list of configuration options that serve only to confuse most users.
|
26
|
+
|
27
|
+
## Installation
|
28
|
+
|
29
|
+
1. Add the following to your site's `Gemfile`:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
gem 'jekyll-seo-tag'
|
33
|
+
```
|
34
|
+
|
35
|
+
2. Add the following to your site's `_config.yml`:
|
36
|
+
|
37
|
+
```yml
|
38
|
+
gems:
|
39
|
+
- jekyll-seo-tag
|
40
|
+
```
|
41
|
+
|
42
|
+
3. Add the following right before `</head>` in your site's template(s):
|
43
|
+
|
44
|
+
```liquid
|
45
|
+
{% seo %}
|
46
|
+
```
|
47
|
+
|
48
|
+
## Usage
|
49
|
+
|
50
|
+
The SEO tag will respect any of the following if included in your site's `_config.yml` (and simply not include them if they're not defined):
|
51
|
+
|
52
|
+
* `title` - Your site's title (e.g., Ben's awesome site, The GitHub Blog, etc.)
|
53
|
+
* `description` - A short description (e.g., A blog dedicated to reviewing cat gifs)
|
54
|
+
* `url` - The full URL to your site. Note: `site.github.url` will be used by default.
|
55
|
+
* `author` - global author information (see below)
|
56
|
+
* `twitter:username` - The site's Twitter handle. You'll want to describe it like so:
|
57
|
+
|
58
|
+
```yml
|
59
|
+
twitter:
|
60
|
+
username: benbalter
|
61
|
+
```
|
62
|
+
|
63
|
+
* `facebook` - The following properties are available:
|
64
|
+
* `facebook:app_id` - a Facebook app ID for Facebook insights
|
65
|
+
* `facebook:publisher` - a Facebook page URL or ID of the publishing entity
|
66
|
+
* `facebook:admins` - a Facebook user ID for domain insights linked to a personal account
|
67
|
+
|
68
|
+
You'll want to describe one or more like so:
|
69
|
+
|
70
|
+
```yml
|
71
|
+
facebook:
|
72
|
+
app_id: 1234
|
73
|
+
publisher: 1234
|
74
|
+
admins: 1234
|
75
|
+
```
|
76
|
+
|
77
|
+
* `logo` - URL to a site-wide logo (e.g., `/assets/your-company-logo.png`)
|
78
|
+
* `social` - For [specifying social profiles](https://developers.google.com/structured-data/customize/social-profiles). The following properties are available:
|
79
|
+
* `name` - If the user or organization name differs from the site's name
|
80
|
+
* `links` - An array of links to social media profiles.
|
81
|
+
* `google_site_verification` for verifying ownership via Google webmaster tools
|
82
|
+
|
83
|
+
The SEO tag will respect the following YAML front matter if included in a post, page, or document:
|
84
|
+
|
85
|
+
* `title` - The title of the post, page, or document
|
86
|
+
* `description` - A short description of the page's content
|
87
|
+
* `image` - URL to an image associated with the post, page, or document (e.g., `/assets/page-pic.jpg`)
|
88
|
+
* `author` - Page-, post-, or document-specific author information (see below)
|
89
|
+
|
90
|
+
## Advanced usage
|
91
|
+
|
92
|
+
Jekyll SEO Tag is designed to implement SEO best practices by default and to be the right fit for most sites right out of the box. If for some reason, you need more control over the output, read on:
|
93
|
+
|
94
|
+
### Disabling `<title>` output
|
95
|
+
|
96
|
+
If for some reason, you don't want the plugin to output `<title>` tags on each page, simply invoke the plugin within your template like so:
|
97
|
+
|
98
|
+
```
|
99
|
+
{% seo title=false %}
|
100
|
+
```
|
101
|
+
|
102
|
+
### Author information
|
103
|
+
|
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`).
|
105
|
+
|
106
|
+
*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
|
+
|
108
|
+
There are several ways to convey this author-specific information. Author information is found in the following order of priority:
|
109
|
+
|
110
|
+
1. An `author` object, in the documents's front matter, e.g.:
|
111
|
+
|
112
|
+
```yml
|
113
|
+
author:
|
114
|
+
twitter: benbalter
|
115
|
+
```
|
116
|
+
|
117
|
+
2. An `author` object, in the site's `_config.yml`, e.g.:
|
118
|
+
|
119
|
+
```yml
|
120
|
+
author:
|
121
|
+
twitter: benbalter
|
122
|
+
```
|
123
|
+
|
124
|
+
3. `site.data.authors[author]`, if an author is specified in the document's front matter, and a corresponding key exists in `site.data.authors`. E.g., you have the following in the document's front matter:
|
125
|
+
|
126
|
+
```yml
|
127
|
+
author: benbalter
|
128
|
+
```
|
129
|
+
|
130
|
+
And you have the following in `_data/authors.yml`:
|
131
|
+
|
132
|
+
```yml
|
133
|
+
benbalter:
|
134
|
+
picture: /img/benbalter.png
|
135
|
+
twitter: jekyllrb
|
136
|
+
|
137
|
+
potus:
|
138
|
+
picture: /img/potus.png
|
139
|
+
twitter: whitehouse
|
140
|
+
```
|
141
|
+
|
142
|
+
In the above example, the author `benbalter`'s Twitter handle will be resolved to `@jekyllrb`. This allows you to centralize author information in a single `_data/authors` file for site with many authors that require more than just the author's username.
|
143
|
+
|
144
|
+
*Pro-tip: If `authors` is present in the document's front matter as an array (and `author` is not), the plugin will use the first author listed, as Twitter supports only one author.*
|
145
|
+
|
146
|
+
4. An author in the document's front matter (the simplest way), e.g.:
|
147
|
+
|
148
|
+
```yml
|
149
|
+
author: benbalter
|
150
|
+
```
|
151
|
+
|
152
|
+
5. An author in the site's `_config.yml`, e.g.:
|
153
|
+
|
154
|
+
```yml
|
155
|
+
author: benbalter
|
156
|
+
```
|
157
|
+
|
158
|
+
### Customizing JSON-LD output
|
159
|
+
|
160
|
+
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.
|
161
|
+
|
162
|
+
* `seo`
|
163
|
+
* `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é")
|
164
|
+
* `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.
|
165
|
+
* `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.
|
166
|
+
|
167
|
+
### Customizing image output
|
168
|
+
|
169
|
+
For most users, setting `image: [path-to-image]` on a per-page basis should be enough. If you need more control over how images are represented, the `image` property can also be an object, with the following options:
|
170
|
+
|
171
|
+
* `path` - The relative path to the image. Same as `image: [path-to-image]`
|
172
|
+
* `twitter` - The relative path to a Twitter-specific image.
|
173
|
+
* `facebook` - The relative path to a Facebook-specific image.
|
174
|
+
* `height` - The height of the Facebook (`og:image`) image
|
175
|
+
* `width` - The width of the Facebook (`og:image`) image
|
176
|
+
|
177
|
+
You can use any of the above, optional properties, like so:
|
178
|
+
|
179
|
+
```yml
|
180
|
+
image:
|
181
|
+
twitter: /img/twitter.png
|
182
|
+
facebook: /img/facebook.png
|
183
|
+
height: 100
|
184
|
+
width: 100
|
185
|
+
```
|
186
|
+
|
187
|
+
### SmartyPants Titles
|
188
|
+
|
189
|
+
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/Rakefile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'jekyll-seo-tag/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'jekyll-seo-tag-yx'
|
8
|
+
spec.version = Jekyll::SeoTag::VERSION
|
9
|
+
spec.authors = ['Ben Balter','Yuxi Fan']
|
10
|
+
spec.email = ['yuxibk@gmail.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 with page canonical url support."
|
12
|
+
spec.homepage = 'https://github.com/yuxibk/jekyll-seo-tag'
|
13
|
+
spec.license = 'MIT'
|
14
|
+
|
15
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
16
|
+
# delete this section to allow pushing this gem to any host.
|
17
|
+
if spec.respond_to?(:metadata)
|
18
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
19
|
+
else
|
20
|
+
raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.'
|
21
|
+
end
|
22
|
+
|
23
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
24
|
+
spec.bindir = 'exe'
|
25
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
26
|
+
spec.require_paths = ['lib']
|
27
|
+
|
28
|
+
spec.add_dependency 'jekyll', '~> 3.1'
|
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
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'jekyll-seo-tag/filters'
|
2
|
+
require 'jekyll-seo-tag/version'
|
3
|
+
|
4
|
+
module Jekyll
|
5
|
+
class SeoTag < Liquid::Tag
|
6
|
+
attr_accessor :context
|
7
|
+
|
8
|
+
MINIFY_REGEX = /([>,]\n|[%}]})\s+?(<|{[{%]|[ ]+\")/
|
9
|
+
|
10
|
+
def initialize(_tag_name, text, _tokens)
|
11
|
+
super
|
12
|
+
@text = text
|
13
|
+
end
|
14
|
+
|
15
|
+
def render(context)
|
16
|
+
@context = context
|
17
|
+
template.render!(payload, info)
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def options
|
23
|
+
{
|
24
|
+
'version' => Jekyll::SeoTag::VERSION,
|
25
|
+
'title' => title?
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
def payload
|
30
|
+
{
|
31
|
+
'page' => context.registers[:page],
|
32
|
+
'site' => context.registers[:site].site_payload['site'],
|
33
|
+
'paginator' => context['paginator'],
|
34
|
+
'seo_tag' => options
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
def title?
|
39
|
+
!(@text =~ /title=false/i)
|
40
|
+
end
|
41
|
+
|
42
|
+
def info
|
43
|
+
{
|
44
|
+
registers: context.registers,
|
45
|
+
filters: [Jekyll::Filters, JekyllSeoTag::Filters]
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
def template
|
50
|
+
@template ||= Liquid::Template.parse template_contents
|
51
|
+
end
|
52
|
+
|
53
|
+
def template_contents
|
54
|
+
@template_contents ||= begin
|
55
|
+
File.read(template_path).gsub(MINIFY_REGEX, '\1\2').chomp
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def template_path
|
60
|
+
@template_path ||= begin
|
61
|
+
File.expand_path './template.html', File.dirname(__FILE__)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
Liquid::Template.register_tag('seo', Jekyll::SeoTag)
|
@@ -0,0 +1,13 @@
|
|
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
|
data/lib/template.html
ADDED
@@ -0,0 +1,223 @@
|
|
1
|
+
<!-- Begin Jekyll SEO tag v{{ seo_tag.version }} -->
|
2
|
+
|
3
|
+
{% if page.url == "/" or page.url == "/about/" %}
|
4
|
+
{% assign seo_homepage_or_about = true %}
|
5
|
+
{% endif %}
|
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
|
+
{% assign seo_site_title = site.title | default: site.name %}
|
12
|
+
|
13
|
+
{% if page.title %}
|
14
|
+
{% assign seo_title = page.title %}
|
15
|
+
{% assign seo_page_title = page.title %}
|
16
|
+
|
17
|
+
{% if seo_site_title %}
|
18
|
+
{% assign seo_title = seo_title | append:" - " | append: seo_site_title %}
|
19
|
+
{% endif %}
|
20
|
+
{% elsif seo_site_title %}
|
21
|
+
{% assign seo_title = seo_site_title %}
|
22
|
+
{% assign seo_page_title = seo_site_title %}
|
23
|
+
|
24
|
+
{% if site.description %}
|
25
|
+
{% assign seo_title = seo_title | append:" - " | append: site.description %}
|
26
|
+
{% endif %}
|
27
|
+
{% endif %}
|
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 | smartify | strip_html | strip_newlines | escape_once %}
|
38
|
+
{% endif %}
|
39
|
+
|
40
|
+
{% if seo_title %}
|
41
|
+
{% assign seo_title = seo_title | smartify | strip_html | strip_newlines | escape_once %}
|
42
|
+
{% endif %}
|
43
|
+
|
44
|
+
{% if seo_site_title %}
|
45
|
+
{% assign seo_site_title = seo_site_title | smartify | strip_html | strip_newlines | escape_once %}
|
46
|
+
{% endif %}
|
47
|
+
|
48
|
+
{% if seo_page_title %}
|
49
|
+
{% assign seo_page_title = seo_page_title | smartify | strip_html | strip_newlines | escape_once %}
|
50
|
+
{% endif %}
|
51
|
+
|
52
|
+
{% assign seo_description = page.description | default: page.excerpt | default: site.description %}
|
53
|
+
{% if seo_description %}
|
54
|
+
{% assign seo_description = seo_description | markdownify | strip_html | strip_newlines | escape_once %}
|
55
|
+
{% endif %}
|
56
|
+
|
57
|
+
{% assign seo_author = page.author | default: page.authors[0] | default: site.author %}
|
58
|
+
{% if seo_author %}
|
59
|
+
{% if seo_author.twitter %}
|
60
|
+
{% assign seo_author_twitter = seo_author.twitter %}
|
61
|
+
{% else %}
|
62
|
+
{% if site.data.authors and site.data.authors[seo_author] %}
|
63
|
+
{% assign seo_author_twitter = site.data.authors[seo_author].twitter %}
|
64
|
+
{% else %}
|
65
|
+
{% assign seo_author_twitter = seo_author %}
|
66
|
+
{% endif %}
|
67
|
+
{% endif %}
|
68
|
+
{% assign seo_author_twitter = seo_author_twitter | replace:"@","" %}
|
69
|
+
{% endif %}
|
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
|
+
|
87
|
+
{% if site.logo %}
|
88
|
+
{% assign seo_site_logo = site.logo %}
|
89
|
+
{% unless seo_site_logo contains "://" %}
|
90
|
+
{% assign seo_site_logo = seo_site_logo | prepend: seo_url %}
|
91
|
+
{% endunless %}
|
92
|
+
{% assign seo_site_logo = seo_site_logo | escape %}
|
93
|
+
{% endif %}
|
94
|
+
|
95
|
+
{% if page.image %}
|
96
|
+
{% assign seo_page_image = page.image.path | default: page.image.facebook | default: page.image %}
|
97
|
+
{% unless seo_page_image contains "://" %}
|
98
|
+
{% assign seo_page_image = seo_page_image | prepend: seo_url %}
|
99
|
+
{% endunless %}
|
100
|
+
{% assign seo_page_image = seo_page_image | escape %}
|
101
|
+
{% endif %}
|
102
|
+
|
103
|
+
{% if seo_tag.title and seo_title %}
|
104
|
+
<title>{{ seo_title }}</title>
|
105
|
+
{% endif %}
|
106
|
+
|
107
|
+
{% if seo_page_title %}
|
108
|
+
<meta property="og:title" content="{{ seo_page_title }}" />
|
109
|
+
{% endif %}
|
110
|
+
|
111
|
+
{% if seo_description %}
|
112
|
+
<meta name="description" content="{{ seo_description }}" />
|
113
|
+
<meta property="og:description" content="{{ seo_description }}" />
|
114
|
+
{% endif %}
|
115
|
+
|
116
|
+
{% if page.canonical_url %}
|
117
|
+
<link rel="canonical" href="{{ page.canonical_url }}" />
|
118
|
+
<meta property="og:url" content="{{ page.canonical_url }}" />
|
119
|
+
{% endif %}
|
120
|
+
|
121
|
+
{% if seo_site_title %}
|
122
|
+
<meta property="og:site_name" content="{{ seo_site_title }}" />
|
123
|
+
{% endif %}
|
124
|
+
|
125
|
+
{% if seo_page_image %}
|
126
|
+
<meta property="og:image" content="{{ seo_page_image }}" />
|
127
|
+
{% if page.image.height %}
|
128
|
+
<meta property="og:image:height" content="{{ page.image.height }}" />
|
129
|
+
{% endif %}
|
130
|
+
{% if page.image.width %}
|
131
|
+
<meta property="og:image:width" content="{{ page.image.width }}" />
|
132
|
+
{% endif %}
|
133
|
+
{% endif %}
|
134
|
+
|
135
|
+
{% if page.image.twitter %}
|
136
|
+
<meta name="twitter:image" content="{{ page.image.twitter | prepend: seo_url | escape }}" />
|
137
|
+
{% endif %}
|
138
|
+
|
139
|
+
{% if page.date %}
|
140
|
+
<meta property="og:type" content="article" />
|
141
|
+
<meta property="article:published_time" content="{{ page.date | date_to_xmlschema }}" />
|
142
|
+
{% endif %}
|
143
|
+
|
144
|
+
{% if paginator.previous_page %}
|
145
|
+
<link rel="prev" href="{{ paginator.previous_page_path | prepend: seo_url }}">
|
146
|
+
{% endif %}
|
147
|
+
{% if paginator.next_page %}
|
148
|
+
<link rel="next" href="{{ paginator.next_page_path | prepend: seo_url }}">
|
149
|
+
{% endif %}
|
150
|
+
|
151
|
+
{% if site.twitter %}
|
152
|
+
{% if seo_page_image or page.image.twitter %}
|
153
|
+
<meta name="twitter:card" content="summary_large_image" />
|
154
|
+
{% else %}
|
155
|
+
<meta name="twitter:card" content="summary" />
|
156
|
+
{% endif %}
|
157
|
+
|
158
|
+
<meta name="twitter:site" content="@{{ site.twitter.username | replace:"@","" }}" />
|
159
|
+
|
160
|
+
{% if seo_author_twitter %}
|
161
|
+
<meta name="twitter:creator" content="@{{ seo_author_twitter }}" />
|
162
|
+
{% endif %}
|
163
|
+
{% endif %}
|
164
|
+
|
165
|
+
{% if site.facebook %}
|
166
|
+
{% if site.facebook.admins %}
|
167
|
+
<meta property="fb:admins" content="{{ site.facebook.admins }}" />
|
168
|
+
{% endif %}
|
169
|
+
|
170
|
+
{% if site.facebook.publisher %}
|
171
|
+
<meta property="article:publisher" content="{{ site.facebook.publisher }}" />
|
172
|
+
{% endif %}
|
173
|
+
|
174
|
+
{% if site.facebook.app_id %}
|
175
|
+
<meta property="fb:app_id" content="{{ site.facebook.app_id }}" />
|
176
|
+
{% endif %}
|
177
|
+
{% endif %}
|
178
|
+
|
179
|
+
{% if site.google_site_verification %}
|
180
|
+
<meta name="google-site-verification" content="{{ site.google_site_verification }}" />
|
181
|
+
{% endif %}
|
182
|
+
|
183
|
+
<script type="application/ld+json">
|
184
|
+
{
|
185
|
+
"@context": "http://schema.org",
|
186
|
+
|
187
|
+
{% if seo_type %}
|
188
|
+
"@type": {{ seo_type | jsonify }},
|
189
|
+
{% endif %}
|
190
|
+
|
191
|
+
{% if seo_name %}
|
192
|
+
"name": {{ seo_name | jsonify }},
|
193
|
+
{% endif %}
|
194
|
+
|
195
|
+
{% if seo_page_title %}
|
196
|
+
"headline": {{ seo_page_title | jsonify }},
|
197
|
+
{% endif %}
|
198
|
+
|
199
|
+
{% if seo_page_image %}
|
200
|
+
"image": {{ seo_page_image | jsonify }},
|
201
|
+
{% endif %}
|
202
|
+
|
203
|
+
{% if page.date %}
|
204
|
+
"datePublished": {{ page.date | date_to_xmlschema | jsonify }},
|
205
|
+
{% endif %}
|
206
|
+
|
207
|
+
{% if seo_description %}
|
208
|
+
"description": {{ seo_description | jsonify }},
|
209
|
+
{% endif %}
|
210
|
+
|
211
|
+
{% if seo_site_logo %}
|
212
|
+
"logo": {{ seo_site_logo | jsonify }},
|
213
|
+
{% endif %}
|
214
|
+
|
215
|
+
{% if seo_links %}
|
216
|
+
"sameAs": {{ seo_links | jsonify }},
|
217
|
+
{% endif %}
|
218
|
+
|
219
|
+
"url": {{ page.url | prepend: seo_url | replace:'/index.html','/' | jsonify }}
|
220
|
+
}
|
221
|
+
</script>
|
222
|
+
|
223
|
+
<!-- End Jekyll SEO tag -->
|
data/script/cibuild
ADDED
data/script/release
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
# Tag and push a release.
|
3
|
+
|
4
|
+
set -e
|
5
|
+
|
6
|
+
# Make sure we're in the project root.
|
7
|
+
|
8
|
+
cd $(dirname "$0")/..
|
9
|
+
|
10
|
+
# Build a new gem archive.
|
11
|
+
|
12
|
+
rm -rf jekyll-seo-tag-*.gem
|
13
|
+
gem build -q jekyll-seo-tag.gemspec
|
14
|
+
|
15
|
+
# Make sure we're on the master branch.
|
16
|
+
|
17
|
+
(git branch | grep -q '* master') || {
|
18
|
+
echo "Only release from the master branch."
|
19
|
+
exit 1
|
20
|
+
}
|
21
|
+
|
22
|
+
# Figure out what version we're releasing.
|
23
|
+
|
24
|
+
tag=v`ls jekyll-seo-tag-*.gem | sed 's/^jekyll-seo-tag-\(.*\)\.gem$/\1/'`
|
25
|
+
|
26
|
+
# Make sure we haven't released this version before.
|
27
|
+
|
28
|
+
git fetch -t origin
|
29
|
+
|
30
|
+
(git tag -l | grep -q "$tag") && {
|
31
|
+
echo "Whoops, there's already a '${tag}' tag."
|
32
|
+
exit 1
|
33
|
+
}
|
34
|
+
|
35
|
+
# Tag it and bag it.
|
36
|
+
|
37
|
+
gem push jekyll-seo-tag-*.gem && git tag "$tag" &&
|
38
|
+
git push origin master && git push origin "$tag"
|
metadata
ADDED
@@ -0,0 +1,147 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jekyll-seo-tag-yx
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ben Balter
|
8
|
+
- Yuxi Fan
|
9
|
+
autorequire:
|
10
|
+
bindir: exe
|
11
|
+
cert_chain: []
|
12
|
+
date: 2016-06-23 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: jekyll
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '3.1'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '3.1'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: bundler
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '1.10'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '1.10'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rake
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '10.0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '10.0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rspec
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '3.3'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '3.3'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: html-proofer
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '2.5'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '2.5'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: rubocop
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - "~>"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0.37'
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0.37'
|
98
|
+
description:
|
99
|
+
email:
|
100
|
+
- yuxibk@gmail.com
|
101
|
+
executables: []
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- ".gitignore"
|
106
|
+
- ".rspec"
|
107
|
+
- ".rubocop.yml"
|
108
|
+
- ".travis.yml"
|
109
|
+
- Gemfile
|
110
|
+
- LICENSE.txt
|
111
|
+
- README.md
|
112
|
+
- Rakefile
|
113
|
+
- jekyll-seo-tag.gemspec
|
114
|
+
- lib/jekyll-seo-tag.rb
|
115
|
+
- lib/jekyll-seo-tag/filters.rb
|
116
|
+
- lib/jekyll-seo-tag/version.rb
|
117
|
+
- lib/template.html
|
118
|
+
- script/bootstrap
|
119
|
+
- script/cibuild
|
120
|
+
- script/release
|
121
|
+
homepage: https://github.com/yuxibk/jekyll-seo-tag
|
122
|
+
licenses:
|
123
|
+
- MIT
|
124
|
+
metadata:
|
125
|
+
allowed_push_host: https://rubygems.org
|
126
|
+
post_install_message:
|
127
|
+
rdoc_options: []
|
128
|
+
require_paths:
|
129
|
+
- lib
|
130
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
requirements: []
|
141
|
+
rubyforge_project:
|
142
|
+
rubygems_version: 2.4.5
|
143
|
+
signing_key:
|
144
|
+
specification_version: 4
|
145
|
+
summary: A Jekyll plugin to add metadata tags for search engines and social networks
|
146
|
+
to better index and display your site's content with page canonical url support.
|
147
|
+
test_files: []
|