jekyll-seo-tag 2.3.0 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/actions/memprof.rb +14 -0
- data/.github/workflows/third-party.yml +61 -0
- data/.gitignore +8 -11
- data/.rubocop.yml +10 -16
- data/.rubocop_todo.yml +13 -0
- data/.travis.yml +16 -5
- data/Gemfile +4 -1
- data/History.markdown +123 -17
- data/LICENSE.txt +1 -1
- data/docs/README.md +2 -2
- data/docs/_config.yml +1 -1
- data/docs/advanced-usage.md +24 -6
- data/docs/installation.md +4 -0
- data/docs/usage.md +41 -28
- data/jekyll-seo-tag.gemspec +9 -9
- data/lib/jekyll-seo-tag.rb +13 -6
- data/lib/jekyll-seo-tag/author_drop.rb +14 -6
- data/lib/jekyll-seo-tag/drop.rb +45 -15
- data/lib/jekyll-seo-tag/filters.rb +2 -0
- data/lib/jekyll-seo-tag/image_drop.rb +15 -7
- data/lib/jekyll-seo-tag/json_ld.rb +2 -0
- data/lib/jekyll-seo-tag/json_ld_drop.rb +15 -3
- data/lib/jekyll-seo-tag/url_helper.rb +3 -0
- data/lib/jekyll-seo-tag/version.rb +3 -1
- data/lib/template.html +27 -15
- metadata +31 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e9eb9dfd036a3ea2c3078d87759738e4606cbf37633996a68568a289fe0aec88
|
4
|
+
data.tar.gz: f351b73b95b687b9195df24044940e104ffebecc109b3f8120013594083583bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4cf8a641a8446757ddb990bb9787a0a4a25f66debe44f3bc740052958fd3417df64efeb9c2a6fd1d8d0ff8e3296bc47eb65f8f97c10b22c89efb613aead4d1b
|
7
|
+
data.tar.gz: a18945dca650e7f6c0834badfd2f8f1c816654e39737666b2b17963017f7a97249b19bc99fb7f02661b66aca03c6ff44c260782030b43e2d7bf5ba6fecc8f040
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'jekyll'
|
4
|
+
require 'memory_profiler'
|
5
|
+
|
6
|
+
MemoryProfiler.report(allow_files: 'lib/jekyll-seo-tag') do
|
7
|
+
Jekyll::PluginManager.require_from_bundler
|
8
|
+
Jekyll::Commands::Build.process({
|
9
|
+
"source" => File.expand_path(ARGV[0]),
|
10
|
+
"destination" => File.expand_path("#{ARGV[0]}/_site"),
|
11
|
+
"disable_disk_cache" => true,
|
12
|
+
})
|
13
|
+
puts ''
|
14
|
+
end.pretty_print(scale_bytes: true, normalize_paths: true)
|
@@ -0,0 +1,61 @@
|
|
1
|
+
name: Third-Party Repository Profiling
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
pull_request:
|
8
|
+
branches:
|
9
|
+
- master
|
10
|
+
jobs:
|
11
|
+
build_n_profile:
|
12
|
+
if: "!contains(github.event.commits[0].message, '[ci skip]')"
|
13
|
+
runs-on: 'ubuntu-latest'
|
14
|
+
steps:
|
15
|
+
- name: Checkout Jekyll SEO Tag
|
16
|
+
uses: actions/checkout@v2
|
17
|
+
with:
|
18
|
+
fetch-depth: 5
|
19
|
+
path: jekyll-seo-tag
|
20
|
+
- name: Checkout Third-Party Repository (WITHOUT SEO Tag)
|
21
|
+
uses: actions/checkout@v2
|
22
|
+
with:
|
23
|
+
repository: ashmaroli/tomjoht.github.io
|
24
|
+
ref: 'no-seo-tag'
|
25
|
+
path: alpha-sandbox
|
26
|
+
- name: Checkout Same Third-Party Repository (WITH SEO Tag)
|
27
|
+
uses: actions/checkout@v2
|
28
|
+
with:
|
29
|
+
repository: ashmaroli/tomjoht.github.io
|
30
|
+
ref: 'seo-tag'
|
31
|
+
path: sandbox
|
32
|
+
- name: Set up Ruby
|
33
|
+
uses: actions/setup-ruby@v1
|
34
|
+
with:
|
35
|
+
ruby-version: 2.6.x
|
36
|
+
- name: Set up Dependencies Cache
|
37
|
+
uses: actions/cache@v1
|
38
|
+
with:
|
39
|
+
path: sandbox/vendor/bundle
|
40
|
+
key: ubuntu-latest-gems-
|
41
|
+
restore-keys: |
|
42
|
+
ubuntu-latest-gems-
|
43
|
+
- name: Set up Dependencies
|
44
|
+
run: |
|
45
|
+
gem update --system --no-document
|
46
|
+
gem update bundler --no-document
|
47
|
+
bundle config gemfile sandbox/Gemfile
|
48
|
+
bundle config path vendor/bundle
|
49
|
+
bundle install --jobs 4 --retry 3
|
50
|
+
- name: Run Jekyll Build (WITHOUT SEO Tag) 3 times
|
51
|
+
run: |
|
52
|
+
bundle exec jekyll build -s alpha-sandbox -d alpha-sandbox/_site --trace
|
53
|
+
bundle exec jekyll build -s alpha-sandbox -d alpha-sandbox/_site --trace
|
54
|
+
bundle exec jekyll build -s alpha-sandbox -d alpha-sandbox/_site --trace
|
55
|
+
- name: Run Jekyll Build (WITH SEO Tag) 3 times
|
56
|
+
run: |
|
57
|
+
bundle exec jekyll build -s sandbox -d sandbox/_site --trace
|
58
|
+
bundle exec jekyll build -s sandbox -d sandbox/_site --trace
|
59
|
+
bundle exec jekyll build -s sandbox -d sandbox/_site --trace
|
60
|
+
- name: Memory Analysis of Jekyll Build (WITH SEO Tag)
|
61
|
+
run: bundle exec ruby jekyll-seo-tag/.github/workflows/actions/memprof.rb sandbox
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,25 +1,19 @@
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
2
|
+
|
3
|
+
require: rubocop-jekyll
|
1
4
|
inherit_gem:
|
2
|
-
jekyll: .rubocop.yml
|
5
|
+
rubocop-jekyll: .rubocop.yml
|
3
6
|
|
4
|
-
|
7
|
+
AllCops:
|
8
|
+
TargetRubyVersion: 2.4
|
5
9
|
Exclude:
|
6
|
-
-
|
7
|
-
- jekyll-seo-tag.gemspec
|
10
|
+
- vendor/**/*
|
8
11
|
|
9
|
-
|
12
|
+
Layout/LineLength:
|
10
13
|
Exclude:
|
11
14
|
- spec/**/*
|
15
|
+
- jekyll-seo-tag.gemspec
|
12
16
|
|
13
|
-
|
14
|
-
Enabled: false
|
15
|
-
|
16
|
-
Style/FileName:
|
17
|
-
Enabled: false
|
18
|
-
|
19
|
-
Style/IndentHeredoc:
|
17
|
+
Metrics/BlockLength:
|
20
18
|
Exclude:
|
21
19
|
- spec/**/*
|
22
|
-
|
23
|
-
AllCops:
|
24
|
-
Exclude:
|
25
|
-
- vendor/**/*
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config --auto-gen-only-exclude`
|
3
|
+
# on 2020-03-20 11:41:46 +0100 using RuboCop version 0.80.1.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 1
|
10
|
+
# Cop supports --auto-correct.
|
11
|
+
Lint/ToJSON:
|
12
|
+
Exclude:
|
13
|
+
- 'lib/jekyll-seo-tag/json_ld_drop.rb'
|
data/.travis.yml
CHANGED
@@ -1,7 +1,18 @@
|
|
1
|
-
rvm:
|
2
|
-
- 2.2.3
|
3
|
-
before_install: gem install bundler
|
4
1
|
language: ruby
|
5
|
-
script: script/cibuild
|
6
|
-
sudo: false
|
7
2
|
cache: bundler
|
3
|
+
rvm:
|
4
|
+
- 2.5
|
5
|
+
- 2.7
|
6
|
+
|
7
|
+
before_install:
|
8
|
+
- gem update --system
|
9
|
+
- gem install bundler
|
10
|
+
|
11
|
+
script: script/cibuild
|
12
|
+
|
13
|
+
env:
|
14
|
+
global:
|
15
|
+
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
16
|
+
matrix:
|
17
|
+
- JEKYLL_VERSION="~> 3.9"
|
18
|
+
- JEKYLL_VERSION="~> 4.0"
|
data/Gemfile
CHANGED
data/History.markdown
CHANGED
@@ -1,40 +1,146 @@
|
|
1
|
-
##
|
1
|
+
## 2.7.0 / 2020-10-18
|
2
|
+
|
3
|
+
### Minor Enhancements
|
4
|
+
|
5
|
+
* Change pagination message with `seo_paginator_message` option (#324)
|
6
|
+
* Make Twitter Summary Card without having Twitter account (#284)
|
7
|
+
* Prefer site.tagline to site.description for page title (#356)
|
8
|
+
* Render og:locale meta only when defined explicitly (#388)
|
9
|
+
|
10
|
+
### Bug Fixes
|
11
|
+
|
12
|
+
* Ensure a single leading `@` for twitter usernames (#367)
|
13
|
+
|
14
|
+
### Development Fixes
|
15
|
+
|
16
|
+
* chore(deps): require Ruby > 2.4.0 EOL
|
17
|
+
* test: fix locale specs that use the fallback locale (#360)
|
18
|
+
* refactor: Replace read-only empty hash with private constant (#418)
|
19
|
+
* refactor: Mutate hash literals instead of duplicating them (#417)
|
20
|
+
* refactor: Reduce allocations of instance-agnostic objects (#376)
|
21
|
+
* refactor: Memoize #author_hash in SeoTag::AuthorDrop (#342)
|
22
|
+
* refactor: simplify conditional in SeoTag::Drop#date_modified (#343)
|
23
|
+
* chore(ci): profile seo-tag plugin on a third-party repository (#414)
|
24
|
+
* chore(ci): Jekyll v4.0 (#372)
|
25
|
+
* chore(ci): test against current stable Ruby 2.5 and 2.7 (#385)
|
26
|
+
* style: align with latest jekyll-rubocop (#382)
|
27
|
+
* fix: Travis builds for Jekyll 3.x (#415)
|
28
|
+
|
29
|
+
### Documentation
|
30
|
+
|
31
|
+
* Structured Data Testing Tool is deprecated (#409)
|
32
|
+
* Rename Google webmaster tools to Google Search Console (#403)
|
33
|
+
* Improve documentation on plugin usage (#399)
|
34
|
+
* remove Google+ from example snippet (#358)
|
35
|
+
* HTTPS link to https://ogp.me/ (#359)
|
36
|
+
* HTTPS links to schema.org (#350)
|
37
|
+
* use example.com for example URL (#351)
|
38
|
+
|
39
|
+
|
40
|
+
## 2.6.1 / 2019-05-17
|
41
|
+
|
42
|
+
### Development Fixes
|
43
|
+
|
44
|
+
* Test against Jekyll 4.x (#336)
|
45
|
+
|
46
|
+
## 2.6.0 / 2019-03-16
|
47
|
+
|
48
|
+
### Minor Enhancements
|
49
|
+
|
50
|
+
* Twitter Image and Title (#330)
|
51
|
+
|
52
|
+
### Bug Fixes
|
53
|
+
|
54
|
+
* Do not cache the drop payload for SeoTag (#306)
|
55
|
+
* Update url of schema website (#296)
|
56
|
+
|
57
|
+
### Development Fixes
|
58
|
+
|
59
|
+
* Relax version constraint on Bundler (#325)
|
60
|
+
* chore(ci): Add Ruby 2.6, drop Ruby 2.3 (#326)
|
61
|
+
* chore (ci): remove deprecated `sudo: false` in .travis.yml (#333)
|
62
|
+
* Lint Ruby code with rubocop-jekyll gem (#302)
|
63
|
+
* chore(deps): bump rubocop-jekyll to v0.4 (#320)
|
64
|
+
* chore(deps): bump rubocop-jekyll to v0.3 (#316)
|
65
|
+
* Correct RuboCop offenses in spec files (#319)
|
66
|
+
|
67
|
+
### Documentation
|
68
|
+
|
69
|
+
* Rectify error in Usage documentation (#328)
|
70
|
+
|
71
|
+
## 2.5.0 / 2018-05-18
|
72
|
+
|
73
|
+
* Docs: Prevent GitHub Pages from processing Liquid raw tag (#276)
|
74
|
+
|
75
|
+
### Documentation
|
76
|
+
|
77
|
+
* Use gems config key for Jekyll < 3.5.0 (#255)
|
78
|
+
* docs/usage - replace "below" with correct link (#280)
|
79
|
+
|
80
|
+
### Development Fixes
|
81
|
+
|
82
|
+
* Test against Ruby 2.5 (#260)
|
83
|
+
* add tests for twitter.card types (#289)
|
84
|
+
* Target Ruby 2.3 and Rubocop 0.56.0 (#292)
|
85
|
+
|
86
|
+
### Minor Enhancements
|
87
|
+
|
88
|
+
* Add webmaster_verifications for baidu (#263)
|
89
|
+
* Include page number in title (#250)
|
90
|
+
* Configure default Twitter summary card type (V2) (#225)
|
91
|
+
|
92
|
+
## 2.4.0 / 2017-12-04
|
93
|
+
|
94
|
+
### Minor
|
95
|
+
|
96
|
+
* Add meta generator (#236)
|
97
|
+
* Consistently use self-closing tags (#246)
|
98
|
+
* Strip null values from JSON-LD hash (#249)
|
99
|
+
|
100
|
+
### Documentation
|
101
|
+
|
102
|
+
* Avoid deprecation warning when building docs (#243)
|
103
|
+
|
104
|
+
### Development Fixes
|
105
|
+
|
106
|
+
* Test against latest Rubies (#242)
|
107
|
+
* Use Nokigiri on CI (#181)
|
2
108
|
|
3
109
|
## 2.3.0
|
4
110
|
|
5
111
|
### Minor Enhancements
|
6
112
|
|
7
|
-
* Use canonical_url specified in page if present #211
|
8
|
-
* Fix for image.path causing an invalid url error #228
|
9
|
-
* Ensure `site.data.authors` is properly formatted before attempting to retrieve author meta #227
|
10
|
-
* Convert author, image, and JSON-LD to dedicated drops #229
|
11
|
-
* Cache parsed template #231
|
12
|
-
* Define path with `__dir__` #232
|
113
|
+
* Use canonical_url specified in page if present #211
|
114
|
+
* Fix for image.path causing an invalid url error #228
|
115
|
+
* Ensure `site.data.authors` is properly formatted before attempting to retrieve author meta #227
|
116
|
+
* Convert author, image, and JSON-LD to dedicated drops #229
|
117
|
+
* Cache parsed template #231
|
118
|
+
* Define path with `__dir__` #232
|
13
119
|
|
14
120
|
### Documentation
|
15
121
|
|
16
|
-
* gems: is deprecated in current Jekyll version of github-pages #230
|
122
|
+
* gems: is deprecated in current Jekyll version of github-pages #230
|
17
123
|
|
18
|
-
## 2.2.3
|
124
|
+
## 2.2.3
|
19
125
|
|
20
|
-
* Guard against the author's Twitter handle being Nil when stripping @'s #203
|
21
|
-
* Guard against empty title or description strings #206
|
126
|
+
* Guard against the author's Twitter handle being Nil when stripping @'s #203
|
127
|
+
* Guard against empty title or description strings #206
|
22
128
|
|
23
129
|
## 2.2.2
|
24
130
|
|
25
131
|
### Minor Enhancements
|
26
132
|
|
27
|
-
* Guard against arrays in subhashes #197
|
28
|
-
* Guard against invalid or missing URLs #199
|
133
|
+
* Guard against arrays in subhashes #197
|
134
|
+
* Guard against invalid or missing URLs #199
|
29
135
|
|
30
136
|
### Development fixes
|
31
137
|
|
32
|
-
* Remove dynamic GitHub Pages logic from Gemfile #194
|
138
|
+
* Remove dynamic GitHub Pages logic from Gemfile #194
|
33
139
|
|
34
140
|
## 2.2.1
|
35
141
|
|
36
|
-
* Convert template logic to a Liquid Drop (significant performance improvement) (#184)
|
37
|
-
* Fix for JSON-LD validation warning for images missing required properties (#183)
|
142
|
+
* Convert template logic to a Liquid Drop (significant performance improvement) (#184)
|
143
|
+
* Fix for JSON-LD validation warning for images missing required properties (#183)
|
38
144
|
|
39
145
|
## 2.2.0
|
40
146
|
|
@@ -44,7 +150,7 @@
|
|
44
150
|
* Add og:locale support #166
|
45
151
|
* Add support for Bing and Yandex webmaster tools. Closes #147 (#148)
|
46
152
|
* Add SEO author and date modified to validate JSON-LD output (#151)
|
47
|
-
|
153
|
+
|
48
154
|
### Minor Enhancements
|
49
155
|
|
50
156
|
* Use `|` for title separator (#162)
|
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2015 Ben Balter
|
3
|
+
Copyright (c) 2015-present Ben Balter and the jekyll-seo-tag contributors
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/docs/README.md
CHANGED
@@ -12,8 +12,8 @@ Jekyll SEO Tag adds the following meta tags to your site:
|
|
12
12
|
* Page description
|
13
13
|
* Canonical URL
|
14
14
|
* Next and previous URLs on paginated pages
|
15
|
-
* [JSON-LD Site and post metadata](https://developers.google.com/structured-data
|
16
|
-
* [Open Graph](
|
15
|
+
* [JSON-LD Site and post metadata](https://developers.google.com/search/docs/guides/intro-structured-data) for richer indexing
|
16
|
+
* [Open Graph](https://ogp.me/) title, description, site title, and URL (for Facebook, LinkedIn, etc.)
|
17
17
|
* [Twitter Summary Card](https://dev.twitter.com/cards/overview) metadata
|
18
18
|
|
19
19
|
While you could theoretically add the necessary metadata tags yourself, Jekyll SEO Tag provides a battle-tested template of crowdsourced best-practices.
|
data/docs/_config.yml
CHANGED
data/docs/advanced-usage.md
CHANGED
@@ -6,9 +6,11 @@ Jekyll SEO Tag is designed to implement SEO best practices by default and to be
|
|
6
6
|
|
7
7
|
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:
|
8
8
|
|
9
|
+
<!-- {% raw %} -->
|
9
10
|
```
|
10
11
|
{% seo title=false %}
|
11
12
|
```
|
13
|
+
<!-- {% endraw %} -->
|
12
14
|
|
13
15
|
### Author information
|
14
16
|
|
@@ -72,8 +74,10 @@ The following options can be set for any particular page. While the default opti
|
|
72
74
|
|
73
75
|
* `seo`
|
74
76
|
* `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é")
|
75
|
-
* `type` - The type of things that the page represents. This must be a [Schema.org type](
|
77
|
+
* `type` - The type of things that the page represents. This must be a [Schema.org type](https://schema.org/docs/schemas.html), and will probably usually be something like [`BlogPosting`](https://schema.org/BlogPosting), [`NewsArticle`](https://schema.org/NewsArticle), [`Person`](https://schema.org/Person), [`Organization`](https://schema.org/Organization), etc.
|
76
78
|
* `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.
|
79
|
+
* `date_modified` - Manually specify the `dateModified` field in the JSON-LD output to override Jekyll's own `dateModified`.
|
80
|
+
This field will take **first priority** for the `dateModified` JSON-LD output. This is useful when the file timestamp does not match the true time that the content was modified. A user may also install [Last Modified At](https://github.com/gjtorikian/jekyll-last-modified-at) which will offer an alternative way of providing for the `dateModified` field.
|
77
81
|
|
78
82
|
### Customizing image output
|
79
83
|
|
@@ -94,7 +98,7 @@ image:
|
|
94
98
|
|
95
99
|
### Setting a default image
|
96
100
|
|
97
|
-
You can define a default image using [Front Matter
|
101
|
+
You can define a default image using [Front Matter defaults](https://jekyllrb.com/docs/configuration/front-matter-defaults/), to provide a default Twitter Card or OGP image to all of your posts and pages.
|
98
102
|
|
99
103
|
Here is a very basic example, that you are encouraged to adapt to your needs:
|
100
104
|
|
@@ -108,11 +112,11 @@ defaults:
|
|
108
112
|
|
109
113
|
### SmartyPants Titles
|
110
114
|
|
111
|
-
Titles will be processed using [Jekyll's `smartify` filter](https://jekyllrb.com/docs/
|
115
|
+
Titles will be processed using [Jekyll's `smartify` filter](https://jekyllrb.com/docs/liquid/filters/). 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.
|
112
116
|
|
113
117
|
### Setting customized Canonical URL
|
114
118
|
|
115
|
-
You can set custom Canonical URL for a page by specifying canonical_url option in page front
|
119
|
+
You can set custom Canonical URL for a page by specifying canonical_url option in page front matter.
|
116
120
|
E.g., you have the following in the page's front matter:
|
117
121
|
```yml
|
118
122
|
layout: post
|
@@ -126,7 +130,7 @@ Which will generate canonical_url with specified link in canonical_url.
|
|
126
130
|
```
|
127
131
|
|
128
132
|
If no canonical_url option was specified, then uses page url for generating canonical_url.
|
129
|
-
E.g., you have not specified canonical_url in front
|
133
|
+
E.g., you have not specified canonical_url in front matter:
|
130
134
|
```yml
|
131
135
|
layout: post
|
132
136
|
title: Title of Your Post
|
@@ -134,5 +138,19 @@ title: Title of Your Post
|
|
134
138
|
|
135
139
|
Which will generate following canonical_url:
|
136
140
|
```html
|
137
|
-
<link rel="canonical" href="
|
141
|
+
<link rel="canonical" href="https://example.com/title-of-your-post" />
|
138
142
|
```
|
143
|
+
|
144
|
+
### Customizing title modifier for paginated pages
|
145
|
+
|
146
|
+
You can override the default title modifier for paginated pages from `Page %{current} of %{total} for ` to a string of your
|
147
|
+
choice by setting a `seo_paginator_message` key in your `_config.yml`.
|
148
|
+
|
149
|
+
For example:
|
150
|
+
|
151
|
+
```yml
|
152
|
+
seo_paginator_message: "%<current>s / %<total>s | "
|
153
|
+
```
|
154
|
+
|
155
|
+
While the value can be any string text, we recommend using a Ruby string-template containing the variables `current` and `total`
|
156
|
+
similar to the example above, to incorporate the current page-number and total number of paginated pages in the title.
|
data/docs/installation.md
CHANGED
@@ -13,8 +13,12 @@
|
|
13
13
|
- jekyll-seo-tag
|
14
14
|
```
|
15
15
|
|
16
|
+
If you are using a Jekyll version less than `3.5.0`, use the `gems` key instead of `plugins`.
|
17
|
+
|
16
18
|
3. Add the following right before `</head>` in your site's template(s):
|
17
19
|
|
20
|
+
<!-- {% raw %} -->
|
18
21
|
```liquid
|
19
22
|
{% seo %}
|
20
23
|
```
|
24
|
+
<!-- {% endraw %} -->
|
data/docs/usage.md
CHANGED
@@ -1,18 +1,29 @@
|
|
1
1
|
## Usage
|
2
2
|
|
3
|
-
The SEO tag will respect any of the following if included in your site's `_config.yml` (and simply not include them if
|
3
|
+
The SEO tag will respect any of the following if included in your site's `_config.yml` (and simply not include them if
|
4
|
+
they're not defined):
|
4
5
|
|
5
|
-
* `title` - Your site's title (e.g., Ben's
|
6
|
-
|
6
|
+
* `title` - Your site's title (e.g., *Ben's Awesome Site*, *The GitHub Blog*, etc.), used as part of the title tag like
|
7
|
+
`Home | Ben's Awesome Site`.
|
8
|
+
* `tagline` - A short description (e.g., *A blog dedicated to reviewing cat gifs*), used as part of the title tag like
|
9
|
+
`Ben's Awesome Site | A blog dedicated to reviewing cat gifs` instead of `Ben's Awesome Site | Long description about a
|
10
|
+
blog dedicated to reviewing cat gifs` that would be used when `page.title` is not defined.
|
11
|
+
* `description` - A longer description used for the description meta tag. Also used as fallback for pages that don't
|
12
|
+
provide their own `description`, and also as part of the page's title tag if neither `page.title` nor `site.tagline`
|
13
|
+
has been defined.
|
7
14
|
* `url` - The full URL to your site. Note: `site.github.url` will be used by default.
|
8
|
-
* `author` - global author information (see
|
9
|
-
* `twitter
|
15
|
+
* `author` - global author information (see [Advanced usage](advanced-usage.md#author-information))
|
16
|
+
* `twitter` - The following properties are available:
|
17
|
+
* `twitter:card` - The site's default card type
|
18
|
+
* `twitter:username` - The site's Twitter handle.
|
19
|
+
|
20
|
+
You'll want to describe them like so:
|
10
21
|
|
11
22
|
```yml
|
12
23
|
twitter:
|
13
24
|
username: benbalter
|
25
|
+
card: summary
|
14
26
|
```
|
15
|
-
|
16
27
|
* `facebook` - The following properties are available:
|
17
28
|
* `facebook:app_id` - a Facebook app ID for Facebook insights
|
18
29
|
* `facebook:publisher` - a Facebook page URL or ID of the publishing entity
|
@@ -20,18 +31,20 @@ The SEO tag will respect any of the following if included in your site's `_confi
|
|
20
31
|
|
21
32
|
You'll want to describe one or more like so:
|
22
33
|
|
23
|
-
|
34
|
+
```yml
|
24
35
|
facebook:
|
25
36
|
app_id: 1234
|
26
37
|
publisher: 1234
|
27
38
|
admins: 1234
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
39
|
+
```
|
40
|
+
* `logo` - URL to a site-wide logo (e.g., `/assets/your-company-logo.png`) - If you would like the "publisher" property
|
41
|
+
to be present, you must add this field to your site's configuration, during the validation of the structured data by
|
42
|
+
Google Search Console, if the `logo` field is not validated, you will find errors inherent to the publisher in the
|
43
|
+
[Rich Results Testing Tool](https://search.google.com/test/rich-results)
|
44
|
+
* `social` - For [specifying social profiles](https://developers.google.com/search/docs/guides/enhance-site#add-your-sites-name-logo-and-social-links).
|
45
|
+
The following properties are available:
|
32
46
|
* `name` - If the user or organization name differs from the site's name
|
33
47
|
* `links` - An array of links to social media profiles.
|
34
|
-
* `date_modified` - Manually specify the `dateModified` field in the JSON-LD output to override Jekyll's own `dateModified`. This field will take **first priority** for the `dateModified` JSON-LD output. This is useful when the file timestamp does not match the true time that the content was modified. A user may also install [Last Modified At](https://github.com/gjtorikian/jekyll-last-modified-at) which will offer an alternative way of providing for the `dateModified` field.
|
35
48
|
|
36
49
|
```yml
|
37
50
|
social:
|
@@ -40,28 +53,28 @@ The SEO tag will respect any of the following if included in your site's `_confi
|
|
40
53
|
- https://twitter.com/BenBalter
|
41
54
|
- https://www.facebook.com/ben.balter
|
42
55
|
- https://www.linkedin.com/in/BenBalter
|
43
|
-
- https://plus.google.com/+BenBalter
|
44
56
|
- https://github.com/benbalter
|
45
57
|
- https://keybase.io/benbalter
|
46
|
-
|
47
|
-
|
48
|
-
* `google_site_verification` for verifying ownership via Google webmaster tools
|
58
|
+
```
|
59
|
+
* `google_site_verification` for verifying ownership via Google Search Console
|
49
60
|
* Alternatively, verify ownership with several services at once using the following format:
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
```
|
58
|
-
|
59
|
-
|
61
|
+
```yml
|
62
|
+
webmaster_verifications:
|
63
|
+
google: 1234
|
64
|
+
bing: 1234
|
65
|
+
alexa: 1234
|
66
|
+
yandex: 1234
|
67
|
+
baidu: 1234
|
68
|
+
```
|
69
|
+
* `locale` - The locale these tags are marked up in. Of the format `language_TERRITORY`. Default is `en_US`. Takes priority
|
70
|
+
over existing config key `lang`.
|
60
71
|
|
61
72
|
The SEO tag will respect the following YAML front matter if included in a post, page, or document:
|
62
73
|
|
63
74
|
* `title` - The title of the post, page, or document
|
64
75
|
* `description` - A short description of the page's content
|
65
76
|
* `image` - URL to an image associated with the post, page, or document (e.g., `/assets/page-pic.jpg`)
|
66
|
-
* `author` - Page-, post-, or document-specific author information (see
|
67
|
-
* `
|
77
|
+
* `author` - Page-, post-, or document-specific author information (see [Advanced usage](advanced-usage.md#author-information))
|
78
|
+
* `locale` - Page-, post-, or document-specific locale information. Takes priority over existing front matter attribute `lang`.
|
79
|
+
|
80
|
+
*Note:* Front matter defaults can be used for any of the above values as described in advanced usage with an image example.
|
data/jekyll-seo-tag.gemspec
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
require "jekyll-seo-tag/version"
|
3
|
+
require_relative "lib/jekyll-seo-tag/version"
|
6
4
|
|
7
5
|
Gem::Specification.new do |spec|
|
8
6
|
spec.name = "jekyll-seo-tag"
|
@@ -10,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
10
8
|
spec.authors = ["Ben Balter"]
|
11
9
|
spec.email = ["ben.balter@github.com"]
|
12
10
|
spec.summary = "A Jekyll plugin to add metadata tags for search engines and social networks to better index and display your site's content."
|
13
|
-
spec.homepage = "https://github.com/
|
11
|
+
spec.homepage = "https://github.com/jekyll/jekyll-seo-tag"
|
14
12
|
spec.license = "MIT"
|
15
13
|
|
16
14
|
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
@@ -21,14 +19,16 @@ Gem::Specification.new do |spec|
|
|
21
19
|
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
22
20
|
end
|
23
21
|
|
22
|
+
spec.required_ruby_version = ">= 2.4.0"
|
23
|
+
|
24
24
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r!^(test|spec|features)/!) }
|
25
25
|
spec.bindir = "exe"
|
26
26
|
spec.executables = spec.files.grep(%r!^exe/!) { |f| File.basename(f) }
|
27
27
|
spec.require_paths = ["lib"]
|
28
28
|
|
29
|
-
spec.add_dependency "jekyll", "
|
30
|
-
spec.add_development_dependency "bundler", "
|
29
|
+
spec.add_dependency "jekyll", ">= 3.8", "< 5.0"
|
30
|
+
spec.add_development_dependency "bundler", ">= 1.15"
|
31
|
+
spec.add_development_dependency "html-proofer", "~> 3.7"
|
31
32
|
spec.add_development_dependency "rspec", "~> 3.5"
|
32
|
-
spec.add_development_dependency "
|
33
|
-
spec.add_development_dependency "rubocop", "~> 0.48"
|
33
|
+
spec.add_development_dependency "rubocop-jekyll", "~> 0.11"
|
34
34
|
end
|
data/lib/jekyll-seo-tag.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "jekyll"
|
2
4
|
require "jekyll-seo-tag/version"
|
3
5
|
|
@@ -22,7 +24,7 @@ module Jekyll
|
|
22
24
|
# We will not strip any whitespace if the next character is a '-'
|
23
25
|
# so that we do not interfere with the HTML comment at the
|
24
26
|
# very begining
|
25
|
-
MINIFY_REGEX = %r!(?<=[{}]|[>,]\n)\s+(?\!-)
|
27
|
+
MINIFY_REGEX = %r!(?<=[{}]|[>,]\n)\s+(?\!-)!.freeze
|
26
28
|
|
27
29
|
def initialize(_tag_name, text, _tokens)
|
28
30
|
super
|
@@ -44,16 +46,21 @@ module Jekyll
|
|
44
46
|
end
|
45
47
|
|
46
48
|
def payload
|
47
|
-
|
49
|
+
# site_payload is an instance of UnifiedPayloadDrop. See https://git.io/v5ajm
|
50
|
+
Jekyll::Utils.deep_merge_hashes(
|
51
|
+
context.registers[:site].site_payload,
|
48
52
|
"page" => context.registers[:page],
|
49
|
-
"site" => context.registers[:site].site_payload["site"],
|
50
53
|
"paginator" => context["paginator"],
|
51
|
-
"seo_tag" => drop
|
52
|
-
|
54
|
+
"seo_tag" => drop
|
55
|
+
)
|
53
56
|
end
|
54
57
|
|
55
58
|
def drop
|
56
|
-
|
59
|
+
if context.registers[:site].liquid_renderer.respond_to?(:cache)
|
60
|
+
Jekyll::SeoTag::Drop.new(@text, @context)
|
61
|
+
else
|
62
|
+
@drop ||= Jekyll::SeoTag::Drop.new(@text, @context)
|
63
|
+
end
|
57
64
|
end
|
58
65
|
|
59
66
|
def info
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Jekyll
|
2
4
|
class SeoTag
|
3
5
|
# A drop representing the current page's author
|
@@ -17,6 +19,7 @@ module Jekyll
|
|
17
19
|
# site - The Jekyll::Drops::SiteDrop
|
18
20
|
def initialize(page: nil, site: nil)
|
19
21
|
raise ArgumentError unless page && site
|
22
|
+
|
20
23
|
@mutations = {}
|
21
24
|
@page = page
|
22
25
|
@site = site
|
@@ -31,6 +34,7 @@ module Jekyll
|
|
31
34
|
|
32
35
|
def twitter
|
33
36
|
return @twitter if defined? @twitter
|
37
|
+
|
34
38
|
twitter = author_hash["twitter"] || author_hash["name"]
|
35
39
|
@twitter = twitter.is_a?(String) ? twitter.sub(%r!^@!, "") : nil
|
36
40
|
end
|
@@ -45,6 +49,7 @@ module Jekyll
|
|
45
49
|
# Returns a string or hash representing the author
|
46
50
|
def resolved_author
|
47
51
|
return @resolved_author if defined? @resolved_author
|
52
|
+
|
48
53
|
sources = [page["author"]]
|
49
54
|
sources << page["authors"].first if page["authors"].is_a?(Array)
|
50
55
|
sources << site["author"]
|
@@ -59,6 +64,7 @@ module Jekyll
|
|
59
64
|
@site_data_hash ||= begin
|
60
65
|
return {} unless resolved_author.is_a?(String)
|
61
66
|
return {} unless site.data["authors"].is_a?(Hash)
|
67
|
+
|
62
68
|
author_hash = site.data["authors"][resolved_author]
|
63
69
|
author_hash.is_a?(Hash) ? author_hash : {}
|
64
70
|
end
|
@@ -68,12 +74,14 @@ module Jekyll
|
|
68
74
|
# including site-wide metadata if the author is provided as a string,
|
69
75
|
# or an empty hash, if the author cannot be resolved
|
70
76
|
def author_hash
|
71
|
-
|
72
|
-
resolved_author
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
+
@author_hash ||= begin
|
78
|
+
if resolved_author.is_a? Hash
|
79
|
+
resolved_author
|
80
|
+
elsif resolved_author.is_a? String
|
81
|
+
{ "name" => resolved_author }.merge!(site_data_hash)
|
82
|
+
else
|
83
|
+
{}
|
84
|
+
end
|
77
85
|
end
|
78
86
|
end
|
79
87
|
|
data/lib/jekyll-seo-tag/drop.rb
CHANGED
@@ -1,18 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Jekyll
|
2
4
|
class SeoTag
|
3
5
|
class Drop < Jekyll::Drops::Drop
|
4
6
|
include Jekyll::SeoTag::UrlHelper
|
5
7
|
|
6
|
-
TITLE_SEPARATOR = " | "
|
7
|
-
FORMAT_STRING_METHODS =
|
8
|
-
markdownify strip_html normalize_whitespace escape_once
|
8
|
+
TITLE_SEPARATOR = " | "
|
9
|
+
FORMAT_STRING_METHODS = [
|
10
|
+
:markdownify, :strip_html, :normalize_whitespace, :escape_once,
|
9
11
|
].freeze
|
10
|
-
HOMEPAGE_OR_ABOUT_REGEX = %r!^/(about/)?(index.html?)
|
12
|
+
HOMEPAGE_OR_ABOUT_REGEX = %r!^/(about/)?(index.html?)?$!.freeze
|
13
|
+
|
14
|
+
EMPTY_READ_ONLY_HASH = {}.freeze
|
15
|
+
private_constant :EMPTY_READ_ONLY_HASH
|
11
16
|
|
12
17
|
def initialize(text, context)
|
13
|
-
@obj =
|
18
|
+
@obj = EMPTY_READ_ONLY_HASH
|
14
19
|
@mutations = {}
|
15
|
-
@text
|
20
|
+
@text = text
|
16
21
|
@context = context
|
17
22
|
end
|
18
23
|
|
@@ -24,6 +29,7 @@ module Jekyll
|
|
24
29
|
def title?
|
25
30
|
return false unless title
|
26
31
|
return @display_title if defined?(@display_title)
|
32
|
+
|
27
33
|
@display_title = (@text !~ %r!title=false!i)
|
28
34
|
end
|
29
35
|
|
@@ -31,6 +37,10 @@ module Jekyll
|
|
31
37
|
@site_title ||= format_string(site["title"] || site["name"])
|
32
38
|
end
|
33
39
|
|
40
|
+
def site_tagline
|
41
|
+
@site_tagline ||= format_string site["tagline"]
|
42
|
+
end
|
43
|
+
|
34
44
|
def site_description
|
35
45
|
@site_description ||= format_string site["description"]
|
36
46
|
end
|
@@ -40,21 +50,32 @@ module Jekyll
|
|
40
50
|
@page_title ||= format_string(page["title"]) || site_title
|
41
51
|
end
|
42
52
|
|
53
|
+
def site_tagline_or_description
|
54
|
+
site_tagline || site_description
|
55
|
+
end
|
56
|
+
|
43
57
|
# Page title with site title or description appended
|
58
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
44
59
|
def title
|
45
60
|
@title ||= begin
|
46
61
|
if site_title && page_title != site_title
|
47
62
|
page_title + TITLE_SEPARATOR + site_title
|
48
63
|
elsif site_description && site_title
|
49
|
-
site_title + TITLE_SEPARATOR +
|
64
|
+
site_title + TITLE_SEPARATOR + site_tagline_or_description
|
50
65
|
else
|
51
66
|
page_title || site_title
|
52
67
|
end
|
53
68
|
end
|
69
|
+
|
70
|
+
return page_number + @title if page_number
|
71
|
+
|
72
|
+
@title
|
54
73
|
end
|
74
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
55
75
|
|
56
76
|
def name
|
57
77
|
return @name if defined?(@name)
|
78
|
+
|
58
79
|
@name = if seo_name
|
59
80
|
seo_name
|
60
81
|
elsif !homepage_or_about?
|
@@ -91,13 +112,7 @@ module Jekyll
|
|
91
112
|
|
92
113
|
def date_modified
|
93
114
|
@date_modified ||= begin
|
94
|
-
date =
|
95
|
-
page_seo["date_modified"]
|
96
|
-
elsif page["last_modified_at"]
|
97
|
-
page["last_modified_at"].to_liquid
|
98
|
-
else
|
99
|
-
page["date"]
|
100
|
-
end
|
115
|
+
date = page_seo["date_modified"] || page["last_modified_at"].to_liquid || page["date"]
|
101
116
|
filters.date_to_xmlschema(date) if date
|
102
117
|
end
|
103
118
|
end
|
@@ -133,6 +148,7 @@ module Jekyll
|
|
133
148
|
def logo
|
134
149
|
@logo ||= begin
|
135
150
|
return unless site["logo"]
|
151
|
+
|
136
152
|
if absolute_url? site["logo"]
|
137
153
|
filters.uri_escape site["logo"]
|
138
154
|
else
|
@@ -145,6 +161,10 @@ module Jekyll
|
|
145
161
|
@page_lang ||= page["lang"] || site["lang"] || "en_US"
|
146
162
|
end
|
147
163
|
|
164
|
+
def page_locale
|
165
|
+
@page_locale ||= (page["locale"] || site["locale"] || page_lang).tr("-", "_")
|
166
|
+
end
|
167
|
+
|
148
168
|
def canonical_url
|
149
169
|
@canonical_url ||= begin
|
150
170
|
if page["canonical_url"].to_s.empty?
|
@@ -173,6 +193,16 @@ module Jekyll
|
|
173
193
|
page["url"] =~ HOMEPAGE_OR_ABOUT_REGEX
|
174
194
|
end
|
175
195
|
|
196
|
+
def page_number
|
197
|
+
return unless @context["paginator"] && @context["paginator"]["page"]
|
198
|
+
|
199
|
+
current = @context["paginator"]["page"]
|
200
|
+
total = @context["paginator"]["total_pages"]
|
201
|
+
paginator_message = site["seo_paginator_message"] || "Page %<current>s of %<total>s for "
|
202
|
+
|
203
|
+
format(paginator_message, :current => current, :total => total) if current > 1
|
204
|
+
end
|
205
|
+
|
176
206
|
attr_reader :context
|
177
207
|
|
178
208
|
def fallback_data
|
@@ -209,7 +239,7 @@ module Jekyll
|
|
209
239
|
if hash[key].is_a?(Hash)
|
210
240
|
hash[key]
|
211
241
|
else
|
212
|
-
|
242
|
+
EMPTY_READ_ONLY_HASH
|
213
243
|
end
|
214
244
|
end
|
215
245
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Jekyll
|
2
4
|
class SeoTag
|
3
5
|
# A drop representing the page image
|
@@ -16,6 +18,7 @@ module Jekyll
|
|
16
18
|
# context - the Liquid::Context
|
17
19
|
def initialize(page: nil, context: nil)
|
18
20
|
raise ArgumentError unless page && context
|
21
|
+
|
19
22
|
@mutations = {}
|
20
23
|
@page = page
|
21
24
|
@context = context
|
@@ -36,13 +39,17 @@ module Jekyll
|
|
36
39
|
|
37
40
|
# The normalized image hash with a `path` key (which may be nil)
|
38
41
|
def image_hash
|
39
|
-
@image_hash ||=
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
42
|
+
@image_hash ||= begin
|
43
|
+
image_meta = page["image"]
|
44
|
+
|
45
|
+
if image_meta.is_a?(Hash)
|
46
|
+
{ "path" => nil }.merge!(image_meta)
|
47
|
+
elsif image_meta.is_a?(String)
|
48
|
+
{ "path" => image_meta }
|
49
|
+
else
|
50
|
+
{ "path" => nil }
|
51
|
+
end
|
52
|
+
end
|
46
53
|
end
|
47
54
|
alias_method :fallback_data, :image_hash
|
48
55
|
|
@@ -55,6 +62,7 @@ module Jekyll
|
|
55
62
|
def absolute_url
|
56
63
|
return unless raw_path
|
57
64
|
return @absolute_url if defined? @absolute_url
|
65
|
+
|
58
66
|
@absolute_url = if raw_path.is_a?(String) && absolute_url?(raw_path) == false
|
59
67
|
filters.absolute_url raw_path
|
60
68
|
else
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Jekyll
|
2
4
|
class SeoTag
|
3
5
|
class JSONLDDrop < Jekyll::Drops::Drop
|
@@ -18,6 +20,9 @@ module Jekyll
|
|
18
20
|
private :type
|
19
21
|
private :logo
|
20
22
|
|
23
|
+
VALID_ENTITY_TYPES = %w(BlogPosting CreativeWork).freeze
|
24
|
+
private_constant :VALID_ENTITY_TYPES
|
25
|
+
|
21
26
|
# page_drop should be an instance of Jekyll::SeoTag::Drop
|
22
27
|
def initialize(page_drop)
|
23
28
|
@mutations = {}
|
@@ -25,13 +30,14 @@ module Jekyll
|
|
25
30
|
end
|
26
31
|
|
27
32
|
def fallback_data
|
28
|
-
{
|
29
|
-
"@context" => "
|
33
|
+
@fallback_data ||= {
|
34
|
+
"@context" => "https://schema.org",
|
30
35
|
}
|
31
36
|
end
|
32
37
|
|
33
38
|
def author
|
34
39
|
return unless page_drop.author["name"]
|
40
|
+
|
35
41
|
{
|
36
42
|
"@type" => "Person",
|
37
43
|
"name" => page_drop.author["name"],
|
@@ -50,6 +56,7 @@ module Jekyll
|
|
50
56
|
|
51
57
|
def publisher
|
52
58
|
return unless logo
|
59
|
+
|
53
60
|
output = {
|
54
61
|
"@type" => "Organization",
|
55
62
|
"logo" => {
|
@@ -62,7 +69,8 @@ module Jekyll
|
|
62
69
|
end
|
63
70
|
|
64
71
|
def main_entity
|
65
|
-
return unless
|
72
|
+
return unless VALID_ENTITY_TYPES.include?(type)
|
73
|
+
|
66
74
|
{
|
67
75
|
"@type" => "WebPage",
|
68
76
|
"@id" => page_drop.canonical_url,
|
@@ -71,6 +79,10 @@ module Jekyll
|
|
71
79
|
alias_method :mainEntityOfPage, :main_entity
|
72
80
|
private :main_entity
|
73
81
|
|
82
|
+
def to_json
|
83
|
+
to_h.reject { |_k, v| v.nil? }.to_json
|
84
|
+
end
|
85
|
+
|
74
86
|
private
|
75
87
|
|
76
88
|
attr_reader :page_drop
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Jekyll
|
2
4
|
class SeoTag
|
3
5
|
# Mixin to share common URL-related methods between class
|
@@ -11,6 +13,7 @@ module Jekyll
|
|
11
13
|
# Returns nil if it is not a string or can't be parsed as a URL
|
12
14
|
def absolute_url?(string)
|
13
15
|
return unless string
|
16
|
+
|
14
17
|
Addressable::URI.parse(string).absolute?
|
15
18
|
rescue Addressable::URI::InvalidURIError
|
16
19
|
nil
|
data/lib/template.html
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
<title>{{ seo_tag.title }}</title>
|
4
4
|
{% endif %}
|
5
5
|
|
6
|
+
<meta name="generator" content="Jekyll v{{ jekyll.version }}" />
|
7
|
+
|
6
8
|
{% if seo_tag.page_title %}
|
7
9
|
<meta property="og:title" content="{{ seo_tag.page_title }}" />
|
8
10
|
{% endif %}
|
@@ -11,7 +13,7 @@
|
|
11
13
|
<meta name="author" content="{{ seo_tag.author.name }}" />
|
12
14
|
{% endif %}
|
13
15
|
|
14
|
-
<meta property="og:locale" content="{{ seo_tag.
|
16
|
+
<meta property="og:locale" content="{{ seo_tag.page_locale }}" />
|
15
17
|
|
16
18
|
{% if seo_tag.description %}
|
17
19
|
<meta name="description" content="{{ seo_tag.description }}" />
|
@@ -43,23 +45,29 @@
|
|
43
45
|
{% endif %}
|
44
46
|
|
45
47
|
{% if paginator.previous_page %}
|
46
|
-
<link rel="prev" href="{{ paginator.previous_page_path | absolute_url }}"
|
48
|
+
<link rel="prev" href="{{ paginator.previous_page_path | absolute_url }}" />
|
47
49
|
{% endif %}
|
48
50
|
{% if paginator.next_page %}
|
49
|
-
<link rel="next" href="{{ paginator.next_page_path | absolute_url }}"
|
51
|
+
<link rel="next" href="{{ paginator.next_page_path | absolute_url }}" />
|
50
52
|
{% endif %}
|
51
53
|
|
52
|
-
{% if site.twitter %}
|
53
|
-
{% if seo_tag.image %}
|
54
|
-
<meta name="twitter:card" content="summary_large_image" />
|
55
|
-
{% else %}
|
56
|
-
<meta name="twitter:card" content="summary" />
|
57
|
-
{% endif %}
|
58
54
|
|
59
|
-
|
55
|
+
{% if seo_tag.image %}
|
56
|
+
<meta name="twitter:card" content="{{ page.twitter.card | default: site.twitter.card | default: "summary_large_image" }}" />
|
57
|
+
<meta property="twitter:image" content="{{ seo_tag.image.path }}" />
|
58
|
+
{% else %}
|
59
|
+
<meta name="twitter:card" content="summary" />
|
60
|
+
{% endif %}
|
61
|
+
|
62
|
+
{% if seo_tag.page_title %}
|
63
|
+
<meta property="twitter:title" content="{{ seo_tag.page_title }}" />
|
64
|
+
{% endif %}
|
65
|
+
|
66
|
+
{% if site.twitter %}
|
67
|
+
<meta name="twitter:site" content="@{{ site.twitter.username | remove:'@' }}" />
|
60
68
|
|
61
69
|
{% if seo_tag.author.twitter %}
|
62
|
-
<meta name="twitter:creator" content="@{{ seo_tag.author.twitter }}" />
|
70
|
+
<meta name="twitter:creator" content="@{{ seo_tag.author.twitter | remove:'@' }}" />
|
63
71
|
{% endif %}
|
64
72
|
{% endif %}
|
65
73
|
|
@@ -79,19 +87,23 @@
|
|
79
87
|
|
80
88
|
{% if site.webmaster_verifications %}
|
81
89
|
{% if site.webmaster_verifications.google %}
|
82
|
-
<meta name="google-site-verification" content="{{ site.webmaster_verifications.google }}"
|
90
|
+
<meta name="google-site-verification" content="{{ site.webmaster_verifications.google }}" />
|
83
91
|
{% endif %}
|
84
92
|
|
85
93
|
{% if site.webmaster_verifications.bing %}
|
86
|
-
<meta name="msvalidate.01" content="{{ site.webmaster_verifications.bing }}"
|
94
|
+
<meta name="msvalidate.01" content="{{ site.webmaster_verifications.bing }}" />
|
87
95
|
{% endif %}
|
88
96
|
|
89
97
|
{% if site.webmaster_verifications.alexa %}
|
90
|
-
<meta name="alexaVerifyID" content="{{ site.webmaster_verifications.alexa }}"
|
98
|
+
<meta name="alexaVerifyID" content="{{ site.webmaster_verifications.alexa }}" />
|
91
99
|
{% endif %}
|
92
100
|
|
93
101
|
{% if site.webmaster_verifications.yandex %}
|
94
|
-
<meta name="yandex-verification" content="{{ site.webmaster_verifications.yandex }}"
|
102
|
+
<meta name="yandex-verification" content="{{ site.webmaster_verifications.yandex }}" />
|
103
|
+
{% endif %}
|
104
|
+
|
105
|
+
{% if site.webmaster_verifications.baidu %}
|
106
|
+
<meta name="baidu-site-verification" content="{{ site.webmaster_verifications.baidu }}" />
|
95
107
|
{% endif %}
|
96
108
|
{% elsif site.google_site_verification %}
|
97
109
|
<meta name="google-site-verification" content="{{ site.google_site_verification }}" />
|
metadata
CHANGED
@@ -1,85 +1,91 @@
|
|
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.7.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:
|
11
|
+
date: 2020-10-18 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
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.8'
|
20
|
+
- - "<"
|
18
21
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
22
|
+
version: '5.0'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.8'
|
30
|
+
- - "<"
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
32
|
+
version: '5.0'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: bundler
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
|
-
- - "
|
37
|
+
- - ">="
|
32
38
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
39
|
+
version: '1.15'
|
34
40
|
type: :development
|
35
41
|
prerelease: false
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
37
43
|
requirements:
|
38
|
-
- - "
|
44
|
+
- - ">="
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1.
|
46
|
+
version: '1.15'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
48
|
+
name: html-proofer
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
51
|
- - "~>"
|
46
52
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3.
|
53
|
+
version: '3.7'
|
48
54
|
type: :development
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
51
57
|
requirements:
|
52
58
|
- - "~>"
|
53
59
|
- !ruby/object:Gem::Version
|
54
|
-
version: '3.
|
60
|
+
version: '3.7'
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
62
|
+
name: rspec
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
58
64
|
requirements:
|
59
65
|
- - "~>"
|
60
66
|
- !ruby/object:Gem::Version
|
61
|
-
version: '3.
|
67
|
+
version: '3.5'
|
62
68
|
type: :development
|
63
69
|
prerelease: false
|
64
70
|
version_requirements: !ruby/object:Gem::Requirement
|
65
71
|
requirements:
|
66
72
|
- - "~>"
|
67
73
|
- !ruby/object:Gem::Version
|
68
|
-
version: '3.
|
74
|
+
version: '3.5'
|
69
75
|
- !ruby/object:Gem::Dependency
|
70
|
-
name: rubocop
|
76
|
+
name: rubocop-jekyll
|
71
77
|
requirement: !ruby/object:Gem::Requirement
|
72
78
|
requirements:
|
73
79
|
- - "~>"
|
74
80
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0.
|
81
|
+
version: '0.11'
|
76
82
|
type: :development
|
77
83
|
prerelease: false
|
78
84
|
version_requirements: !ruby/object:Gem::Requirement
|
79
85
|
requirements:
|
80
86
|
- - "~>"
|
81
87
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0.
|
88
|
+
version: '0.11'
|
83
89
|
description:
|
84
90
|
email:
|
85
91
|
- ben.balter@github.com
|
@@ -87,9 +93,12 @@ executables: []
|
|
87
93
|
extensions: []
|
88
94
|
extra_rdoc_files: []
|
89
95
|
files:
|
96
|
+
- ".github/workflows/actions/memprof.rb"
|
97
|
+
- ".github/workflows/third-party.yml"
|
90
98
|
- ".gitignore"
|
91
99
|
- ".rspec"
|
92
100
|
- ".rubocop.yml"
|
101
|
+
- ".rubocop_todo.yml"
|
93
102
|
- ".travis.yml"
|
94
103
|
- Gemfile
|
95
104
|
- History.markdown
|
@@ -115,7 +124,7 @@ files:
|
|
115
124
|
- script/cibuild
|
116
125
|
- script/release
|
117
126
|
- script/site
|
118
|
-
homepage: https://github.com/
|
127
|
+
homepage: https://github.com/jekyll/jekyll-seo-tag
|
119
128
|
licenses:
|
120
129
|
- MIT
|
121
130
|
metadata:
|
@@ -128,15 +137,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
128
137
|
requirements:
|
129
138
|
- - ">="
|
130
139
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
140
|
+
version: 2.4.0
|
132
141
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
142
|
requirements:
|
134
143
|
- - ">="
|
135
144
|
- !ruby/object:Gem::Version
|
136
145
|
version: '0'
|
137
146
|
requirements: []
|
138
|
-
|
139
|
-
rubygems_version: 2.6.11
|
147
|
+
rubygems_version: 3.0.6
|
140
148
|
signing_key:
|
141
149
|
specification_version: 4
|
142
150
|
summary: A Jekyll plugin to add metadata tags for search engines and social networks
|