jekyll-seo-tag 2.6.1 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 56e6db909499c8ba306ee172c818f463f1409b3f31759bac7f7b344a2ea67fb6
4
- data.tar.gz: cc3dbe920fae5441b04ed5a3452b16c4d55d13b0958fbf43a6bbe52c59ec1e28
3
+ metadata.gz: e9eb9dfd036a3ea2c3078d87759738e4606cbf37633996a68568a289fe0aec88
4
+ data.tar.gz: f351b73b95b687b9195df24044940e104ffebecc109b3f8120013594083583bd
5
5
  SHA512:
6
- metadata.gz: ed7c5b987ec70f5c9bbabdff7fcc6b950514f1616f063e978dbd8dab63c62a5f95c43be4aece27c9cb612e7684fff2ed38d5d40d65a0d38a6ea182c1467bc0dd
7
- data.tar.gz: 56bee779d96a1ef131d7c2606916ad6744ddb83f1a753173111becedbe8f282fa4b9b5182c40a407e0c8e9049f260f972c3432d96798ac57cb2ff40364a7e19b
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
@@ -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
@@ -5,11 +5,11 @@ inherit_gem:
5
5
  rubocop-jekyll: .rubocop.yml
6
6
 
7
7
  AllCops:
8
- TargetRubyVersion: 2.3
8
+ TargetRubyVersion: 2.4
9
9
  Exclude:
10
10
  - vendor/**/*
11
11
 
12
- Metrics/LineLength:
12
+ Layout/LineLength:
13
13
  Exclude:
14
14
  - spec/**/*
15
15
  - jekyll-seo-tag.gemspec
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
- # `rubocop --auto-gen-config`
3
- # on 2019-03-25 11:42:06 +0100 using RuboCop version 0.66.0.
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
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -1,8 +1,8 @@
1
1
  language: ruby
2
2
  cache: bundler
3
3
  rvm:
4
- - 2.4
5
- - 2.6
4
+ - 2.5
5
+ - 2.7
6
6
 
7
7
  before_install:
8
8
  - gem update --system
@@ -14,5 +14,5 @@ env:
14
14
  global:
15
15
  - NOKOGIRI_USE_SYSTEM_LIBRARIES=true
16
16
  matrix:
17
- - JEKYLL_VERSION="~> 3.3"
18
- - JEKYLL_VERSION=">= 4.0.0.pre.alpha1"
17
+ - JEKYLL_VERSION="~> 3.9"
18
+ - JEKYLL_VERSION="~> 4.0"
data/Gemfile CHANGED
@@ -5,3 +5,4 @@ source "https://rubygems.org"
5
5
  gemspec
6
6
 
7
7
  gem "jekyll", ENV["JEKYLL_VERSION"] if ENV["JEKYLL_VERSION"]
8
+ gem "kramdown-parser-gfm" if ENV["JEKYLL_VERSION"] == "~> 3.9"
@@ -1,3 +1,42 @@
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
+
1
40
  ## 2.6.1 / 2019-05-17
2
41
 
3
42
  ### Development Fixes
@@ -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.
@@ -74,7 +74,7 @@ The following options can be set for any particular page. While the default opti
74
74
 
75
75
  * `seo`
76
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é")
77
- * `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.
78
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
79
  * `date_modified` - Manually specify the `dateModified` field in the JSON-LD output to override Jekyll's own `dateModified`.
80
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.
@@ -98,7 +98,7 @@ image:
98
98
 
99
99
  ### Setting a default image
100
100
 
101
- 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.
102
102
 
103
103
  Here is a very basic example, that you are encouraged to adapt to your needs:
104
104
 
@@ -112,11 +112,11 @@ defaults:
112
112
 
113
113
  ### SmartyPants Titles
114
114
 
115
- 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.
116
116
 
117
117
  ### Setting customized Canonical URL
118
118
 
119
- 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.
120
120
  E.g., you have the following in the page's front matter:
121
121
  ```yml
122
122
  layout: post
@@ -130,7 +130,7 @@ Which will generate canonical_url with specified link in canonical_url.
130
130
  ```
131
131
 
132
132
  If no canonical_url option was specified, then uses page url for generating canonical_url.
133
- E.g., you have not specified canonical_url in front-matter:
133
+ E.g., you have not specified canonical_url in front matter:
134
134
  ```yml
135
135
  layout: post
136
136
  title: Title of Your Post
@@ -138,5 +138,19 @@ title: Title of Your Post
138
138
 
139
139
  Which will generate following canonical_url:
140
140
  ```html
141
- <link rel="canonical" href="http://yoursite.com/title-of-your-post" />
141
+ <link rel="canonical" href="https://example.com/title-of-your-post" />
142
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.
@@ -1,22 +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
15
  * `author` - global author information (see [Advanced usage](advanced-usage.md#author-information))
9
-
10
16
  * `twitter` - The following properties are available:
11
17
  * `twitter:card` - The site's default card type
12
- * `twitter:username` - The site's Twitter handle. You'll want to describe it like so:
18
+ * `twitter:username` - The site's Twitter handle.
19
+
20
+ You'll want to describe them like so:
13
21
 
14
22
  ```yml
15
23
  twitter:
16
24
  username: benbalter
17
25
  card: summary
18
26
  ```
19
-
20
27
  * `facebook` - The following properties are available:
21
28
  * `facebook:app_id` - a Facebook app ID for Facebook insights
22
29
  * `facebook:publisher` - a Facebook page URL or ID of the publishing entity
@@ -30,9 +37,12 @@ The SEO tag will respect any of the following if included in your site's `_confi
30
37
  publisher: 1234
31
38
  admins: 1234
32
39
  ```
33
-
34
- * `logo` - URL to a site-wide logo (e.g., `/assets/your-company-logo.png`) - If you would like the "publisher" property to be present, you must add this field to your site's configuration, during the validation of the structured data by Google web master tools, if the `logo` field is not validated, you will find errors inherent to the publisher in the [structured datas test](https://search.google.com/structured-data/testing-tool/u/0/)
35
- * `social` - For [specifying social profiles](https://developers.google.com/structured-data/customize/social-profiles). The following properties are available:
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:
36
46
  * `name` - If the user or organization name differs from the site's name
37
47
  * `links` - An array of links to social media profiles.
38
48
 
@@ -43,24 +53,21 @@ The SEO tag will respect any of the following if included in your site's `_confi
43
53
  - https://twitter.com/BenBalter
44
54
  - https://www.facebook.com/ben.balter
45
55
  - https://www.linkedin.com/in/BenBalter
46
- - https://plus.google.com/+BenBalter
47
56
  - https://github.com/benbalter
48
57
  - https://keybase.io/benbalter
49
58
  ```
50
-
51
- * `google_site_verification` for verifying ownership via Google webmaster tools
59
+ * `google_site_verification` for verifying ownership via Google Search Console
52
60
  * Alternatively, verify ownership with several services at once using the following format:
53
-
54
- ```yml
55
- webmaster_verifications:
56
- google: 1234
57
- bing: 1234
58
- alexa: 1234
59
- yandex: 1234
60
- baidu: 1234
61
- ```
62
-
63
- * `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`.
64
71
 
65
72
  The SEO tag will respect the following YAML front matter if included in a post, page, or document:
66
73
 
@@ -68,6 +75,6 @@ The SEO tag will respect the following YAML front matter if included in a post,
68
75
  * `description` - A short description of the page's content
69
76
  * `image` - URL to an image associated with the post, page, or document (e.g., `/assets/page-pic.jpg`)
70
77
  * `author` - Page-, post-, or document-specific author information (see [Advanced usage](advanced-usage.md#author-information))
71
- * `lang` - Page-, post-, or document-specific language information
78
+ * `locale` - Page-, post-, or document-specific locale information. Takes priority over existing front matter attribute `lang`.
72
79
 
73
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,16 +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
 
24
- spec.required_ruby_version = ">= 2.3.0"
22
+ spec.required_ruby_version = ">= 2.4.0"
25
23
 
26
24
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r!^(test|spec|features)/!) }
27
25
  spec.bindir = "exe"
28
26
  spec.executables = spec.files.grep(%r!^exe/!) { |f| File.basename(f) }
29
27
  spec.require_paths = ["lib"]
30
28
 
31
- spec.add_dependency "jekyll", ">= 3.3", "< 5.0"
29
+ spec.add_dependency "jekyll", ">= 3.8", "< 5.0"
32
30
  spec.add_development_dependency "bundler", ">= 1.15"
33
31
  spec.add_development_dependency "html-proofer", "~> 3.7"
34
32
  spec.add_development_dependency "rspec", "~> 3.5"
35
- spec.add_development_dependency "rubocop-jekyll", "~> 0.4"
33
+ spec.add_development_dependency "rubocop-jekyll", "~> 0.11"
36
34
  end
@@ -74,12 +74,14 @@ module Jekyll
74
74
  # including site-wide metadata if the author is provided as a string,
75
75
  # or an empty hash, if the author cannot be resolved
76
76
  def author_hash
77
- if resolved_author.is_a? Hash
78
- resolved_author
79
- elsif resolved_author.is_a? String
80
- { "name" => resolved_author }.merge(site_data_hash)
81
- else
82
- {}
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
83
85
  end
84
86
  end
85
87
 
@@ -11,10 +11,13 @@ module Jekyll
11
11
  ].freeze
12
12
  HOMEPAGE_OR_ABOUT_REGEX = %r!^/(about/)?(index.html?)?$!.freeze
13
13
 
14
+ EMPTY_READ_ONLY_HASH = {}.freeze
15
+ private_constant :EMPTY_READ_ONLY_HASH
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
 
@@ -34,6 +37,10 @@ module Jekyll
34
37
  @site_title ||= format_string(site["title"] || site["name"])
35
38
  end
36
39
 
40
+ def site_tagline
41
+ @site_tagline ||= format_string site["tagline"]
42
+ end
43
+
37
44
  def site_description
38
45
  @site_description ||= format_string site["description"]
39
46
  end
@@ -43,6 +50,10 @@ module Jekyll
43
50
  @page_title ||= format_string(page["title"]) || site_title
44
51
  end
45
52
 
53
+ def site_tagline_or_description
54
+ site_tagline || site_description
55
+ end
56
+
46
57
  # Page title with site title or description appended
47
58
  # rubocop:disable Metrics/CyclomaticComplexity
48
59
  def title
@@ -50,7 +61,7 @@ module Jekyll
50
61
  if site_title && page_title != site_title
51
62
  page_title + TITLE_SEPARATOR + site_title
52
63
  elsif site_description && site_title
53
- site_title + TITLE_SEPARATOR + site_description
64
+ site_title + TITLE_SEPARATOR + site_tagline_or_description
54
65
  else
55
66
  page_title || site_title
56
67
  end
@@ -101,13 +112,7 @@ module Jekyll
101
112
 
102
113
  def date_modified
103
114
  @date_modified ||= begin
104
- date = if page_seo["date_modified"]
105
- page_seo["date_modified"]
106
- elsif page["last_modified_at"]
107
- page["last_modified_at"].to_liquid
108
- else
109
- page["date"]
110
- end
115
+ date = page_seo["date_modified"] || page["last_modified_at"].to_liquid || page["date"]
111
116
  filters.date_to_xmlschema(date) if date
112
117
  end
113
118
  end
@@ -156,6 +161,10 @@ module Jekyll
156
161
  @page_lang ||= page["lang"] || site["lang"] || "en_US"
157
162
  end
158
163
 
164
+ def page_locale
165
+ @page_locale ||= (page["locale"] || site["locale"] || page_lang).tr("-", "_")
166
+ end
167
+
159
168
  def canonical_url
160
169
  @canonical_url ||= begin
161
170
  if page["canonical_url"].to_s.empty?
@@ -189,8 +198,9 @@ module Jekyll
189
198
 
190
199
  current = @context["paginator"]["page"]
191
200
  total = @context["paginator"]["total_pages"]
201
+ paginator_message = site["seo_paginator_message"] || "Page %<current>s of %<total>s for "
192
202
 
193
- return "Page #{current} of #{total} for " if current > 1
203
+ format(paginator_message, :current => current, :total => total) if current > 1
194
204
  end
195
205
 
196
206
  attr_reader :context
@@ -229,7 +239,7 @@ module Jekyll
229
239
  if hash[key].is_a?(Hash)
230
240
  hash[key]
231
241
  else
232
- {}
242
+ EMPTY_READ_ONLY_HASH
233
243
  end
234
244
  end
235
245
  end
@@ -39,13 +39,17 @@ module Jekyll
39
39
 
40
40
  # The normalized image hash with a `path` key (which may be nil)
41
41
  def image_hash
42
- @image_hash ||= if page["image"].is_a?(Hash)
43
- { "path" => nil }.merge(page["image"])
44
- elsif page["image"].is_a?(String)
45
- { "path" => page["image"] }
46
- else
47
- { "path" => nil }
48
- 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
49
53
  end
50
54
  alias_method :fallback_data, :image_hash
51
55
 
@@ -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,7 +30,7 @@ module Jekyll
27
30
  end
28
31
 
29
32
  def fallback_data
30
- {
33
+ @fallback_data ||= {
31
34
  "@context" => "https://schema.org",
32
35
  }
33
36
  end
@@ -66,7 +69,7 @@ module Jekyll
66
69
  end
67
70
 
68
71
  def main_entity
69
- return unless %w(BlogPosting CreativeWork).include?(type)
72
+ return unless VALID_ENTITY_TYPES.include?(type)
70
73
 
71
74
  {
72
75
  "@type" => "WebPage",
@@ -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.6.1"
8
+ VERSION = "2.7.0"
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,19 +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="{{ 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
54
 
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 %}
62
63
  <meta property="twitter:title" content="{{ seo_tag.page_title }}" />
63
- <meta name="twitter:site" content="@{{ site.twitter.username | replace:"@","" }}" />
64
+ {% endif %}
65
+
66
+ {% if site.twitter %}
67
+ <meta name="twitter:site" content="@{{ site.twitter.username | remove:'@' }}" />
64
68
 
65
69
  {% if seo_tag.author.twitter %}
66
- <meta name="twitter:creator" content="@{{ seo_tag.author.twitter }}" />
70
+ <meta name="twitter:creator" content="@{{ seo_tag.author.twitter | remove:'@' }}" />
67
71
  {% endif %}
68
72
  {% endif %}
69
73
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-seo-tag
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.1
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: 2019-05-17 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
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '3.3'
19
+ version: '3.8'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: '5.0'
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '3.3'
29
+ version: '3.8'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '5.0'
@@ -78,14 +78,14 @@ dependencies:
78
78
  requirements:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: '0.4'
81
+ version: '0.11'
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: '0.4'
88
+ version: '0.11'
89
89
  description:
90
90
  email:
91
91
  - ben.balter@github.com
@@ -93,6 +93,8 @@ executables: []
93
93
  extensions: []
94
94
  extra_rdoc_files: []
95
95
  files:
96
+ - ".github/workflows/actions/memprof.rb"
97
+ - ".github/workflows/third-party.yml"
96
98
  - ".gitignore"
97
99
  - ".rspec"
98
100
  - ".rubocop.yml"
@@ -122,7 +124,7 @@ files:
122
124
  - script/cibuild
123
125
  - script/release
124
126
  - script/site
125
- homepage: https://github.com/benbalter/jekyll-seo-tag
127
+ homepage: https://github.com/jekyll/jekyll-seo-tag
126
128
  licenses:
127
129
  - MIT
128
130
  metadata:
@@ -135,14 +137,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
135
137
  requirements:
136
138
  - - ">="
137
139
  - !ruby/object:Gem::Version
138
- version: 2.3.0
140
+ version: 2.4.0
139
141
  required_rubygems_version: !ruby/object:Gem::Requirement
140
142
  requirements:
141
143
  - - ">="
142
144
  - !ruby/object:Gem::Version
143
145
  version: '0'
144
146
  requirements: []
145
- rubygems_version: 3.0.3
147
+ rubygems_version: 3.0.6
146
148
  signing_key:
147
149
  specification_version: 4
148
150
  summary: A Jekyll plugin to add metadata tags for search engines and social networks