jekyll-seo-tag 2.4.0 → 2.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 2228c5b86fbff03b257d705f372337ff4efc9484
4
- data.tar.gz: 0aab240d866dba1da02d1be3f6c103131d0263a8
2
+ SHA256:
3
+ metadata.gz: 0d857a1e0d0f1195353559393693772706229a997bcacaa669de788d2d0c22e2
4
+ data.tar.gz: f88d0b9da96a0ad9f697268c9b7bc0a6842e29c19fbc4f95d7749a49cdbecdff
5
5
  SHA512:
6
- metadata.gz: 3f24c19c1cf505c2697ab1e41a70c69fbd2a6a37a4a4348248955807f9f6e95a9db1b1c60ab91567fbd2a904ec1867652be529aa8816419b53387462fb3fc680
7
- data.tar.gz: 6a69a9471ad6e287939308638a67e73657fd3d9445a6ad6a22be3a884edd9b0d3a7ae808185cfcf71df343a62e6e530d0edfaaf87123aef8b176abe9da0f2fd7
6
+ metadata.gz: 52707339211591e65592b3704e520f750bc48607499a6c495242acedafda28b2af84d80595b1ef0c765eb0c96bf6c305ad799f7607c4ccff0f9f0938e9dbd086
7
+ data.tar.gz: 3b56000f6a1ca551d2c5ba6495e0caf71836e707229676c086ccabe423397e3312bc8f6efb08aeb119282f9b6b0d0bafe58b3a5701b205f2c2178c5e8c6e33bf
@@ -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
@@ -1,12 +1,9 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- /bin/
11
1
  *.gem
12
- _site
2
+ .bundle
3
+ .yardoc
4
+ Gemfile.lock
5
+ pkg
6
+ spec/reports/
7
+ spec/fixtures/.jekyll-cache
8
+ tmp/
9
+ vendor/bundle
@@ -1,20 +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
- Metrics/LineLength:
7
+ AllCops:
8
+ TargetRubyVersion: 2.4
5
9
  Exclude:
6
- - spec/**/*
7
- - jekyll-seo-tag.gemspec
10
+ - vendor/**/*
8
11
 
9
- Metrics/BlockLength:
12
+ Layout/LineLength:
10
13
  Exclude:
11
14
  - spec/**/*
15
+ - jekyll-seo-tag.gemspec
12
16
 
13
- Layout/IndentHeredoc:
17
+ Metrics/BlockLength:
14
18
  Exclude:
15
19
  - spec/**/*
16
-
17
- AllCops:
18
- TargetRubyVersion: 2.1
19
- Exclude:
20
- - vendor/**/*
@@ -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'
@@ -1,14 +1,18 @@
1
- rvm:
2
- - 2.1
3
- - 2.2
4
- - 2.3
5
- - 2.4
6
- before_install: gem install bundler
7
1
  language: ruby
8
- script: script/cibuild
9
- sudo: false
10
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
11
12
 
12
13
  env:
13
14
  global:
14
15
  - NOKOGIRI_USE_SYSTEM_LIBRARIES=true
16
+ matrix:
17
+ - JEKYLL_VERSION="~> 3.9"
18
+ - JEKYLL_VERSION="~> 4.0"
data/Gemfile CHANGED
@@ -4,4 +4,5 @@ source "https://rubygems.org"
4
4
 
5
5
  gemspec
6
6
 
7
- gem "github-pages", :group => :jekyll_plugins
7
+ gem "jekyll", ENV["JEKYLL_VERSION"] if ENV["JEKYLL_VERSION"]
8
+ gem "kramdown-parser-gfm" if ENV["JEKYLL_VERSION"] == "~> 3.9"
@@ -1,4 +1,98 @@
1
- ## HEAD
1
+ ## 2.7.1 / 2020-10-18
2
+
3
+ ### Development Fixes
4
+
5
+ * refactor: mutate site payload instead of duplicating it (#419)
6
+
7
+ ## 2.7.0 / 2020-10-18
8
+
9
+ ### Minor Enhancements
10
+
11
+ * Change pagination message with `seo_paginator_message` option (#324)
12
+ * Make Twitter Summary Card without having Twitter account (#284)
13
+ * Prefer site.tagline to site.description for page title (#356)
14
+ * Render og:locale meta only when defined explicitly (#388)
15
+
16
+ ### Bug Fixes
17
+
18
+ * Ensure a single leading `@` for twitter usernames (#367)
19
+
20
+ ### Development Fixes
21
+
22
+ * chore(deps): require Ruby > 2.4.0 EOL
23
+ * test: fix locale specs that use the fallback locale (#360)
24
+ * refactor: Replace read-only empty hash with private constant (#418)
25
+ * refactor: Mutate hash literals instead of duplicating them (#417)
26
+ * refactor: Reduce allocations of instance-agnostic objects (#376)
27
+ * refactor: Memoize #author_hash in SeoTag::AuthorDrop (#342)
28
+ * refactor: simplify conditional in SeoTag::Drop#date_modified (#343)
29
+ * chore(ci): profile seo-tag plugin on a third-party repository (#414)
30
+ * chore(ci): Jekyll v4.0 (#372)
31
+ * chore(ci): test against current stable Ruby 2.5 and 2.7 (#385)
32
+ * style: align with latest jekyll-rubocop (#382)
33
+ * fix: Travis builds for Jekyll 3.x (#415)
34
+
35
+ ### Documentation
36
+
37
+ * Structured Data Testing Tool is deprecated (#409)
38
+ * Rename Google webmaster tools to Google Search Console (#403)
39
+ * Improve documentation on plugin usage (#399)
40
+ * remove Google+ from example snippet (#358)
41
+ * HTTPS link to https://ogp.me/ (#359)
42
+ * HTTPS links to schema.org (#350)
43
+ * use example.com for example URL (#351)
44
+
45
+ ## 2.6.1 / 2019-05-17
46
+
47
+ ### Development Fixes
48
+
49
+ * Test against Jekyll 4.x (#336)
50
+
51
+ ## 2.6.0 / 2019-03-16
52
+
53
+ ### Minor Enhancements
54
+
55
+ * Twitter Image and Title (#330)
56
+
57
+ ### Bug Fixes
58
+
59
+ * Do not cache the drop payload for SeoTag (#306)
60
+ * Update url of schema website (#296)
61
+
62
+ ### Development Fixes
63
+
64
+ * Relax version constraint on Bundler (#325)
65
+ * chore(ci): Add Ruby 2.6, drop Ruby 2.3 (#326)
66
+ * chore (ci): remove deprecated `sudo: false` in .travis.yml (#333)
67
+ * Lint Ruby code with rubocop-jekyll gem (#302)
68
+ * chore(deps): bump rubocop-jekyll to v0.4 (#320)
69
+ * chore(deps): bump rubocop-jekyll to v0.3 (#316)
70
+ * Correct RuboCop offenses in spec files (#319)
71
+
72
+ ### Documentation
73
+
74
+ * Rectify error in Usage documentation (#328)
75
+
76
+ ## 2.5.0 / 2018-05-18
77
+
78
+ * Docs: Prevent GitHub Pages from processing Liquid raw tag (#276)
79
+
80
+ ### Documentation
81
+
82
+ * Use gems config key for Jekyll < 3.5.0 (#255)
83
+ * docs/usage - replace "below" with correct link (#280)
84
+
85
+ ### Development Fixes
86
+
87
+ * Test against Ruby 2.5 (#260)
88
+ * add tests for twitter.card types (#289)
89
+ * Target Ruby 2.3 and Rubocop 0.56.0 (#292)
90
+
91
+ ### Minor Enhancements
92
+
93
+ * Add webmaster_verifications for baidu (#263)
94
+ * Include page number in title (#250)
95
+ * Configure default Twitter summary card type (V2) (#225)
2
96
 
3
97
  ## 2.4.0 / 2017-12-04
4
98
 
@@ -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
@@ -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/) for richer indexing
16
- * [Open Graph](http://ogp.me/) title, description, site title, and URL (for Facebook, LinkedIn, etc.)
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.
@@ -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](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.
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 default](https://jekyllrb.com/docs/configuration/#front-matter-defaults), to provide a default Twitter Card or OGP image to all of your posts and pages.
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/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.
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-matter.
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-matter:
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="http://yoursite.com/title-of-your-post" />
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.
@@ -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 %} -->
@@ -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 they're not defined):
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 awesome site, The GitHub Blog, etc.)
6
- * `description` - A short description (e.g., A blog dedicated to reviewing cat gifs)
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 below)
9
- * `twitter:username` - The site's Twitter handle. You'll want to describe it like so:
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
- ```yml
34
+ ```yml
24
35
  facebook:
25
36
  app_id: 1234
26
37
  publisher: 1234
27
38
  admins: 1234
28
- ```
29
-
30
- * `logo` - URL to a site-wide logo (e.g., `/assets/your-company-logo.png`)
31
- * `social` - For [specifying social profiles](https://developers.google.com/structured-data/customize/social-profiles). The following properties are available:
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
- ```yml
52
- webmaster_verifications:
53
- google: 1234
54
- bing: 1234
55
- alexa: 1234
56
- yandex: 1234
57
- ```
58
-
59
- * `lang` - The locale these tags are marked up in. Of the format `language_TERRITORY`. Default is `en_US`.
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 below)
67
- * `lang` - Page-, post-, or document-specific language information
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.
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- lib = File.expand_path("lib", __dir__)
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/benbalter/jekyll-seo-tag"
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", "~> 3.3"
30
- spec.add_development_dependency "bundler", "~> 1.15"
29
+ spec.add_dependency "jekyll", ">= 3.8", "< 5.0"
30
+ spec.add_development_dependency "bundler", ">= 1.15"
31
31
  spec.add_development_dependency "html-proofer", "~> 3.7"
32
32
  spec.add_development_dependency "rspec", "~> 3.5"
33
- spec.add_development_dependency "rubocop", "~> 0.5"
33
+ spec.add_development_dependency "rubocop-jekyll", "~> 0.11"
34
34
  end
@@ -24,7 +24,7 @@ module Jekyll
24
24
  # We will not strip any whitespace if the next character is a '-'
25
25
  # so that we do not interfere with the HTML comment at the
26
26
  # very begining
27
- MINIFY_REGEX = %r!(?<=[{}]|[>,]\n)\s+(?\!-)!
27
+ MINIFY_REGEX = %r!(?<=[{}]|[>,]\n)\s+(?\!-)!.freeze
28
28
 
29
29
  def initialize(_tag_name, text, _tokens)
30
30
  super
@@ -47,15 +47,19 @@ module Jekyll
47
47
 
48
48
  def payload
49
49
  # site_payload is an instance of UnifiedPayloadDrop. See https://git.io/v5ajm
50
- Jekyll::Utils.deep_merge_hashes(context.registers[:site].site_payload, {
51
- "page" => context.registers[:page],
52
- "paginator" => context["paginator"],
53
- "seo_tag" => drop,
54
- })
50
+ context.registers[:site].site_payload.tap do |site_payload|
51
+ site_payload["page"] = context.registers[:page]
52
+ site_payload["paginator"] = context["paginator"]
53
+ site_payload["seo_tag"] = drop
54
+ end
55
55
  end
56
56
 
57
57
  def drop
58
- @drop ||= Jekyll::SeoTag::Drop.new(@text, @context)
58
+ if context.registers[:site].liquid_renderer.respond_to?(:cache)
59
+ Jekyll::SeoTag::Drop.new(@text, @context)
60
+ else
61
+ @drop ||= Jekyll::SeoTag::Drop.new(@text, @context)
62
+ end
59
63
  end
60
64
 
61
65
  def info
@@ -19,6 +19,7 @@ module Jekyll
19
19
  # site - The Jekyll::Drops::SiteDrop
20
20
  def initialize(page: nil, site: nil)
21
21
  raise ArgumentError unless page && site
22
+
22
23
  @mutations = {}
23
24
  @page = page
24
25
  @site = site
@@ -33,6 +34,7 @@ module Jekyll
33
34
 
34
35
  def twitter
35
36
  return @twitter if defined? @twitter
37
+
36
38
  twitter = author_hash["twitter"] || author_hash["name"]
37
39
  @twitter = twitter.is_a?(String) ? twitter.sub(%r!^@!, "") : nil
38
40
  end
@@ -47,6 +49,7 @@ module Jekyll
47
49
  # Returns a string or hash representing the author
48
50
  def resolved_author
49
51
  return @resolved_author if defined? @resolved_author
52
+
50
53
  sources = [page["author"]]
51
54
  sources << page["authors"].first if page["authors"].is_a?(Array)
52
55
  sources << site["author"]
@@ -61,6 +64,7 @@ module Jekyll
61
64
  @site_data_hash ||= begin
62
65
  return {} unless resolved_author.is_a?(String)
63
66
  return {} unless site.data["authors"].is_a?(Hash)
67
+
64
68
  author_hash = site.data["authors"][resolved_author]
65
69
  author_hash.is_a?(Hash) ? author_hash : {}
66
70
  end
@@ -70,12 +74,14 @@ module Jekyll
70
74
  # including site-wide metadata if the author is provided as a string,
71
75
  # or an empty hash, if the author cannot be resolved
72
76
  def author_hash
73
- if resolved_author.is_a? Hash
74
- resolved_author
75
- elsif resolved_author.is_a? String
76
- { "name" => resolved_author }.merge(site_data_hash)
77
- else
78
- {}
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
79
85
  end
80
86
  end
81
87
 
@@ -5,16 +5,19 @@ module Jekyll
5
5
  class Drop < Jekyll::Drops::Drop
6
6
  include Jekyll::SeoTag::UrlHelper
7
7
 
8
- TITLE_SEPARATOR = " | ".freeze
9
- FORMAT_STRING_METHODS = %i[
10
- markdownify strip_html normalize_whitespace escape_once
8
+ TITLE_SEPARATOR = " | "
9
+ FORMAT_STRING_METHODS = [
10
+ :markdownify, :strip_html, :normalize_whitespace, :escape_once,
11
11
  ].freeze
12
- 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
13
16
 
14
17
  def initialize(text, context)
15
- @obj = {}
18
+ @obj = EMPTY_READ_ONLY_HASH
16
19
  @mutations = {}
17
- @text = text
20
+ @text = text
18
21
  @context = context
19
22
  end
20
23
 
@@ -26,6 +29,7 @@ module Jekyll
26
29
  def title?
27
30
  return false unless title
28
31
  return @display_title if defined?(@display_title)
32
+
29
33
  @display_title = (@text !~ %r!title=false!i)
30
34
  end
31
35
 
@@ -33,6 +37,10 @@ module Jekyll
33
37
  @site_title ||= format_string(site["title"] || site["name"])
34
38
  end
35
39
 
40
+ def site_tagline
41
+ @site_tagline ||= format_string site["tagline"]
42
+ end
43
+
36
44
  def site_description
37
45
  @site_description ||= format_string site["description"]
38
46
  end
@@ -42,21 +50,32 @@ module Jekyll
42
50
  @page_title ||= format_string(page["title"]) || site_title
43
51
  end
44
52
 
53
+ def site_tagline_or_description
54
+ site_tagline || site_description
55
+ end
56
+
45
57
  # Page title with site title or description appended
58
+ # rubocop:disable Metrics/CyclomaticComplexity
46
59
  def title
47
60
  @title ||= begin
48
61
  if site_title && page_title != site_title
49
62
  page_title + TITLE_SEPARATOR + site_title
50
63
  elsif site_description && site_title
51
- site_title + TITLE_SEPARATOR + site_description
64
+ site_title + TITLE_SEPARATOR + site_tagline_or_description
52
65
  else
53
66
  page_title || site_title
54
67
  end
55
68
  end
69
+
70
+ return page_number + @title if page_number
71
+
72
+ @title
56
73
  end
74
+ # rubocop:enable Metrics/CyclomaticComplexity
57
75
 
58
76
  def name
59
77
  return @name if defined?(@name)
78
+
60
79
  @name = if seo_name
61
80
  seo_name
62
81
  elsif !homepage_or_about?
@@ -93,13 +112,7 @@ module Jekyll
93
112
 
94
113
  def date_modified
95
114
  @date_modified ||= begin
96
- date = if page_seo["date_modified"]
97
- page_seo["date_modified"]
98
- elsif page["last_modified_at"]
99
- page["last_modified_at"].to_liquid
100
- else
101
- page["date"]
102
- end
115
+ date = page_seo["date_modified"] || page["last_modified_at"].to_liquid || page["date"]
103
116
  filters.date_to_xmlschema(date) if date
104
117
  end
105
118
  end
@@ -135,6 +148,7 @@ module Jekyll
135
148
  def logo
136
149
  @logo ||= begin
137
150
  return unless site["logo"]
151
+
138
152
  if absolute_url? site["logo"]
139
153
  filters.uri_escape site["logo"]
140
154
  else
@@ -147,6 +161,10 @@ module Jekyll
147
161
  @page_lang ||= page["lang"] || site["lang"] || "en_US"
148
162
  end
149
163
 
164
+ def page_locale
165
+ @page_locale ||= (page["locale"] || site["locale"] || page_lang).tr("-", "_")
166
+ end
167
+
150
168
  def canonical_url
151
169
  @canonical_url ||= begin
152
170
  if page["canonical_url"].to_s.empty?
@@ -175,6 +193,16 @@ module Jekyll
175
193
  page["url"] =~ HOMEPAGE_OR_ABOUT_REGEX
176
194
  end
177
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
+
178
206
  attr_reader :context
179
207
 
180
208
  def fallback_data
@@ -211,7 +239,7 @@ module Jekyll
211
239
  if hash[key].is_a?(Hash)
212
240
  hash[key]
213
241
  else
214
- {}
242
+ EMPTY_READ_ONLY_HASH
215
243
  end
216
244
  end
217
245
  end
@@ -18,6 +18,7 @@ module Jekyll
18
18
  # context - the Liquid::Context
19
19
  def initialize(page: nil, context: nil)
20
20
  raise ArgumentError unless page && context
21
+
21
22
  @mutations = {}
22
23
  @page = page
23
24
  @context = context
@@ -38,13 +39,17 @@ module Jekyll
38
39
 
39
40
  # The normalized image hash with a `path` key (which may be nil)
40
41
  def image_hash
41
- @image_hash ||= if page["image"].is_a?(Hash)
42
- { "path" => nil }.merge(page["image"])
43
- elsif page["image"].is_a?(String)
44
- { "path" => page["image"] }
45
- else
46
- { "path" => nil }
47
- end
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
48
53
  end
49
54
  alias_method :fallback_data, :image_hash
50
55
 
@@ -57,6 +62,7 @@ module Jekyll
57
62
  def absolute_url
58
63
  return unless raw_path
59
64
  return @absolute_url if defined? @absolute_url
65
+
60
66
  @absolute_url = if raw_path.is_a?(String) && absolute_url?(raw_path) == false
61
67
  filters.absolute_url raw_path
62
68
  else
@@ -20,6 +20,9 @@ module Jekyll
20
20
  private :type
21
21
  private :logo
22
22
 
23
+ VALID_ENTITY_TYPES = %w(BlogPosting CreativeWork).freeze
24
+ private_constant :VALID_ENTITY_TYPES
25
+
23
26
  # page_drop should be an instance of Jekyll::SeoTag::Drop
24
27
  def initialize(page_drop)
25
28
  @mutations = {}
@@ -27,13 +30,14 @@ module Jekyll
27
30
  end
28
31
 
29
32
  def fallback_data
30
- {
31
- "@context" => "http://schema.org",
33
+ @fallback_data ||= {
34
+ "@context" => "https://schema.org",
32
35
  }
33
36
  end
34
37
 
35
38
  def author
36
39
  return unless page_drop.author["name"]
40
+
37
41
  {
38
42
  "@type" => "Person",
39
43
  "name" => page_drop.author["name"],
@@ -52,6 +56,7 @@ module Jekyll
52
56
 
53
57
  def publisher
54
58
  return unless logo
59
+
55
60
  output = {
56
61
  "@type" => "Organization",
57
62
  "logo" => {
@@ -64,7 +69,8 @@ module Jekyll
64
69
  end
65
70
 
66
71
  def main_entity
67
- return unless %w(BlogPosting CreativeWork).include?(type)
72
+ return unless VALID_ENTITY_TYPES.include?(type)
73
+
68
74
  {
69
75
  "@type" => "WebPage",
70
76
  "@id" => page_drop.canonical_url,
@@ -13,6 +13,7 @@ module Jekyll
13
13
  # Returns nil if it is not a string or can't be parsed as a URL
14
14
  def absolute_url?(string)
15
15
  return unless string
16
+
16
17
  Addressable::URI.parse(string).absolute?
17
18
  rescue Addressable::URI::InvalidURIError
18
19
  nil
@@ -5,6 +5,6 @@ module Liquid; class Tag; end; end
5
5
 
6
6
  module Jekyll
7
7
  class SeoTag < Liquid::Tag
8
- VERSION = "2.4.0".freeze
8
+ VERSION = "2.7.1"
9
9
  end
10
10
  end
@@ -13,7 +13,7 @@
13
13
  <meta name="author" content="{{ seo_tag.author.name }}" />
14
14
  {% endif %}
15
15
 
16
- <meta property="og:locale" content="{{ seo_tag.page_lang | replace:'-','_' }}" />
16
+ <meta property="og:locale" content="{{ seo_tag.page_locale }}" />
17
17
 
18
18
  {% if seo_tag.description %}
19
19
  <meta name="description" content="{{ seo_tag.description }}" />
@@ -51,17 +51,23 @@
51
51
  <link rel="next" href="{{ paginator.next_page_path | absolute_url }}" />
52
52
  {% endif %}
53
53
 
54
- {% if site.twitter %}
55
- {% if seo_tag.image %}
56
- <meta name="twitter:card" content="summary_large_image" />
57
- {% else %}
58
- <meta name="twitter:card" content="summary" />
59
- {% endif %}
60
54
 
61
- <meta name="twitter:site" content="@{{ site.twitter.username | replace:"@","" }}" />
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:'@' }}" />
62
68
 
63
69
  {% if seo_tag.author.twitter %}
64
- <meta name="twitter:creator" content="@{{ seo_tag.author.twitter }}" />
70
+ <meta name="twitter:creator" content="@{{ seo_tag.author.twitter | remove:'@' }}" />
65
71
  {% endif %}
66
72
  {% endif %}
67
73
 
@@ -95,6 +101,10 @@
95
101
  {% if site.webmaster_verifications.yandex %}
96
102
  <meta name="yandex-verification" content="{{ site.webmaster_verifications.yandex }}" />
97
103
  {% endif %}
104
+
105
+ {% if site.webmaster_verifications.baidu %}
106
+ <meta name="baidu-site-verification" content="{{ site.webmaster_verifications.baidu }}" />
107
+ {% endif %}
98
108
  {% elsif site.google_site_verification %}
99
109
  <meta name="google-site-verification" content="{{ site.google_site_verification }}" />
100
110
  {% endif %}
metadata CHANGED
@@ -1,41 +1,47 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-seo-tag
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Balter
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-08 00:00:00.000000000 Z
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: '3.3'
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: '3.3'
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
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
46
  version: '1.15'
41
47
  - !ruby/object:Gem::Dependency
@@ -67,19 +73,19 @@ dependencies:
67
73
  - !ruby/object:Gem::Version
68
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.5'
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.5'
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/benbalter/jekyll-seo-tag
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: '0'
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
- rubyforge_project:
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