From 6906e8792e7b4e482340e889e158d255d485e0f7 Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Mon, 21 Sep 2020 21:09:43 +0530 Subject: [PATCH 01/31] Fix Travis builds for Jekyll 3.x (#415) Merge pull request 415 --- .travis.yml | 2 +- Gemfile | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3575f92..d5ffa5c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,5 +14,5 @@ env: global: - NOKOGIRI_USE_SYSTEM_LIBRARIES=true matrix: - - JEKYLL_VERSION="~> 3.8" + - JEKYLL_VERSION="~> 3.9" - JEKYLL_VERSION="~> 4.0" diff --git a/Gemfile b/Gemfile index a1ebfdb..40f83de 100644 --- a/Gemfile +++ b/Gemfile @@ -5,3 +5,4 @@ source "https://rubygems.org" gemspec gem "jekyll", ENV["JEKYLL_VERSION"] if ENV["JEKYLL_VERSION"] +gem "kramdown-parser-gfm" if ENV["JEKYLL_VERSION"] == "~> 3.9" From ae6ce57b36878e3150cef1c2cff933725d473ec4 Mon Sep 17 00:00:00 2001 From: jekyllbot Date: Mon, 21 Sep 2020 11:39:45 -0400 Subject: [PATCH 02/31] Update history to reflect merge of #415 [ci skip] --- History.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/History.markdown b/History.markdown index fdb8d0b..3f2594e 100644 --- a/History.markdown +++ b/History.markdown @@ -28,6 +28,7 @@ ### Bug Fixes * Reduce allocations of instance-agnostic objects (#376) + * Fix Travis builds for Jekyll 3.x (#415) ## 2.6.1 / 2019-05-17 From c00f3dbc26cfe1f95cf49d1514a3481e9b84d047 Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Wed, 30 Sep 2020 15:07:34 +0530 Subject: [PATCH 03/31] Profile plugin using a third-party repo (#414) Merge pull request 414 --- .github/workflows/actions/memprof.rb | 14 +++++++ .github/workflows/third-party.yml | 61 ++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 .github/workflows/actions/memprof.rb create mode 100644 .github/workflows/third-party.yml diff --git a/.github/workflows/actions/memprof.rb b/.github/workflows/actions/memprof.rb new file mode 100644 index 0000000..45143d8 --- /dev/null +++ b/.github/workflows/actions/memprof.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +require 'jekyll' +require 'memory_profiler' + +MemoryProfiler.report(allow_files: 'lib/jekyll-seo-tag') do + Jekyll::PluginManager.require_from_bundler + Jekyll::Commands::Build.process({ + "source" => File.expand_path(ARGV[0]), + "destination" => File.expand_path("#{ARGV[0]}/_site"), + "disable_disk_cache" => true, + }) + puts '' +end.pretty_print(scale_bytes: true, normalize_paths: true) diff --git a/.github/workflows/third-party.yml b/.github/workflows/third-party.yml new file mode 100644 index 0000000..e450e8a --- /dev/null +++ b/.github/workflows/third-party.yml @@ -0,0 +1,61 @@ +name: Third-Party Repository Profiling + +on: + push: + branches: + - master + pull_request: + branches: + - master +jobs: + build_n_profile: + if: "!contains(github.event.commits[0].message, '[ci skip]')" + runs-on: 'ubuntu-latest' + steps: + - name: Checkout Jekyll SEO Tag + uses: actions/checkout@v2 + with: + fetch-depth: 5 + path: jekyll-seo-tag + - name: Checkout Third-Party Repository (WITHOUT SEO Tag) + uses: actions/checkout@v2 + with: + repository: ashmaroli/tomjoht.github.io + ref: 'no-seo-tag' + path: alpha-sandbox + - name: Checkout Same Third-Party Repository (WITH SEO Tag) + uses: actions/checkout@v2 + with: + repository: ashmaroli/tomjoht.github.io + ref: 'seo-tag' + path: sandbox + - name: Set up Ruby + uses: actions/setup-ruby@v1 + with: + ruby-version: 2.6.x + - name: Set up Dependencies Cache + uses: actions/cache@v1 + with: + path: sandbox/vendor/bundle + key: ubuntu-latest-gems- + restore-keys: | + ubuntu-latest-gems- + - name: Set up Dependencies + run: | + gem update --system --no-document + gem update bundler --no-document + bundle config gemfile sandbox/Gemfile + bundle config path vendor/bundle + bundle install --jobs 4 --retry 3 + - name: Run Jekyll Build (WITHOUT SEO Tag) 3 times + run: | + bundle exec jekyll build -s alpha-sandbox -d alpha-sandbox/_site --trace + bundle exec jekyll build -s alpha-sandbox -d alpha-sandbox/_site --trace + bundle exec jekyll build -s alpha-sandbox -d alpha-sandbox/_site --trace + - name: Run Jekyll Build (WITH SEO Tag) 3 times + run: | + bundle exec jekyll build -s sandbox -d sandbox/_site --trace + bundle exec jekyll build -s sandbox -d sandbox/_site --trace + bundle exec jekyll build -s sandbox -d sandbox/_site --trace + - name: Memory Analysis of Jekyll Build (WITH SEO Tag) + run: bundle exec ruby jekyll-seo-tag/.github/workflows/actions/memprof.rb sandbox From ae0f02f1e0b26e000178d538b4114823f256b8ea Mon Sep 17 00:00:00 2001 From: jekyllbot Date: Wed, 30 Sep 2020 05:37:36 -0400 Subject: [PATCH 04/31] Update history to reflect merge of #414 [ci skip] --- History.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/History.markdown b/History.markdown index 3f2594e..be4034a 100644 --- a/History.markdown +++ b/History.markdown @@ -24,6 +24,7 @@ * chore(ci): test Jekyll v4.0 (#372) * Fix locale specs that use the fallback locale (#360) * style: align with latest jekyll-rubocop (#382) + * Profile plugin using a third-party repo (#414) ### Bug Fixes From 76e062d734f0ad4d41dbc6df3904cb037cd14b1e Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Wed, 7 Oct 2020 21:21:32 +0530 Subject: [PATCH 05/31] Mutate hash literals instead of duplicating them (#417) Merge pull request 417 --- lib/jekyll-seo-tag/author_drop.rb | 2 +- lib/jekyll-seo-tag/image_drop.rb | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/lib/jekyll-seo-tag/author_drop.rb b/lib/jekyll-seo-tag/author_drop.rb index b55cff0..2baa95e 100644 --- a/lib/jekyll-seo-tag/author_drop.rb +++ b/lib/jekyll-seo-tag/author_drop.rb @@ -78,7 +78,7 @@ module Jekyll if resolved_author.is_a? Hash resolved_author elsif resolved_author.is_a? String - { "name" => resolved_author }.merge(site_data_hash) + { "name" => resolved_author }.merge!(site_data_hash) else {} end diff --git a/lib/jekyll-seo-tag/image_drop.rb b/lib/jekyll-seo-tag/image_drop.rb index 32148ed..5427353 100644 --- a/lib/jekyll-seo-tag/image_drop.rb +++ b/lib/jekyll-seo-tag/image_drop.rb @@ -39,13 +39,17 @@ module Jekyll # The normalized image hash with a `path` key (which may be nil) def image_hash - @image_hash ||= if page["image"].is_a?(Hash) - { "path" => nil }.merge(page["image"]) - elsif page["image"].is_a?(String) - { "path" => page["image"] } - else - { "path" => nil } - end + @image_hash ||= begin + image_meta = page["image"] + + if image_meta.is_a?(Hash) + { "path" => nil }.merge!(image_meta) + elsif image_meta.is_a?(String) + { "path" => image_meta } + else + { "path" => nil } + end + end end alias_method :fallback_data, :image_hash From dac459f6f980544db950c7011af4854345457bb3 Mon Sep 17 00:00:00 2001 From: jekyllbot Date: Wed, 7 Oct 2020 11:51:34 -0400 Subject: [PATCH 06/31] Update history to reflect merge of #417 [ci skip] --- History.markdown | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/History.markdown b/History.markdown index be4034a..8ba28f4 100644 --- a/History.markdown +++ b/History.markdown @@ -31,6 +31,10 @@ * Reduce allocations of instance-agnostic objects (#376) * Fix Travis builds for Jekyll 3.x (#415) +### -dev + + * Mutate hash literals instead of duplicating them (#417) + ## 2.6.1 / 2019-05-17 ### Development Fixes From 54beeaaaf611f803535bdc447bfee24126930f29 Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Thu, 8 Oct 2020 20:12:00 +0530 Subject: [PATCH 07/31] Render og:locale meta only when defined explicitly (#388) Merge pull request 388 --- docs/usage.md | 5 +++-- lib/jekyll-seo-tag/drop.rb | 4 ++++ lib/template.html | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/usage.md b/docs/usage.md index 78fcf07..489c233 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -66,7 +66,8 @@ The following properties are available: yandex: 1234 baidu: 1234 ``` -* `lang` - The locale these tags are marked up in. Of the format `language_TERRITORY`. Default is `en_US`. +* `locale` - The locale these tags are marked up in. Of the format `language_TERRITORY`. Default is `en_US`. Takes priority +over existing config key `lang`. The SEO tag will respect the following YAML front matter if included in a post, page, or document: @@ -74,6 +75,6 @@ The SEO tag will respect the following YAML front matter if included in a post, * `description` - A short description of the page's content * `image` - URL to an image associated with the post, page, or document (e.g., `/assets/page-pic.jpg`) * `author` - Page-, post-, or document-specific author information (see [Advanced usage](advanced-usage.md#author-information)) -* `lang` - Page-, post-, or document-specific language information +* `locale` - Page-, post-, or document-specific locale information. Takes priority over existing front matter attribute `lang`. *Note:* Front matter defaults can be used for any of the above values as described in advanced usage with an image example. diff --git a/lib/jekyll-seo-tag/drop.rb b/lib/jekyll-seo-tag/drop.rb index cb806d6..bd3710c 100644 --- a/lib/jekyll-seo-tag/drop.rb +++ b/lib/jekyll-seo-tag/drop.rb @@ -164,6 +164,10 @@ module Jekyll @page_lang ||= page["lang"] || site["lang"] || "en_US" end + def page_locale + @page_locale ||= (page["locale"] || site["locale"] || page_lang).tr("-", "_") + end + def canonical_url @canonical_url ||= begin if page["canonical_url"].to_s.empty? diff --git a/lib/template.html b/lib/template.html index d7aea1b..bc507e7 100755 --- a/lib/template.html +++ b/lib/template.html @@ -13,7 +13,7 @@ {% endif %} - + {% if seo_tag.description %} From 442133d89885bf59b8e31fc4b027956d56ba53b6 Mon Sep 17 00:00:00 2001 From: jekyllbot Date: Thu, 8 Oct 2020 10:42:02 -0400 Subject: [PATCH 08/31] Update history to reflect merge of #388 [ci skip] --- History.markdown | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/History.markdown b/History.markdown index 8ba28f4..8006850 100644 --- a/History.markdown +++ b/History.markdown @@ -17,6 +17,7 @@ * Ensure a single leading `@` for twitter usernames (#367) * Prefer site.tagline to site.description for page title (#356) * chore(ci): bump Ruby versions (#385) + * Render og:locale meta only when defined explicitly (#388) ### Development Fixes @@ -29,10 +30,7 @@ ### Bug Fixes * Reduce allocations of instance-agnostic objects (#376) - * Fix Travis builds for Jekyll 3.x (#415) - -### -dev - + * Fix Travis builds for Jekyll 3.x ### -dev (#415) * Mutate hash literals instead of duplicating them (#417) ## 2.6.1 / 2019-05-17 From e1ff8ee6e8f7de3624e0cc92f0144fd2f1976726 Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Thu, 8 Oct 2020 20:43:37 +0530 Subject: [PATCH 09/31] Simplify conditional in SeoTag::Drop#date_modified (#343) Merge pull request 343 --- lib/jekyll-seo-tag/drop.rb | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/jekyll-seo-tag/drop.rb b/lib/jekyll-seo-tag/drop.rb index bd3710c..3ee277d 100644 --- a/lib/jekyll-seo-tag/drop.rb +++ b/lib/jekyll-seo-tag/drop.rb @@ -109,13 +109,7 @@ module Jekyll def date_modified @date_modified ||= begin - date = if page_seo["date_modified"] - page_seo["date_modified"] - elsif page["last_modified_at"] - page["last_modified_at"].to_liquid - else - page["date"] - end + date = page_seo["date_modified"] || page["last_modified_at"].to_liquid || page["date"] filters.date_to_xmlschema(date) if date end end From d77ffc4de590ae6fcb8a007aef5cf1f07768345e Mon Sep 17 00:00:00 2001 From: jekyllbot Date: Thu, 8 Oct 2020 11:13:38 -0400 Subject: [PATCH 10/31] Update history to reflect merge of #343 [ci skip] --- History.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/History.markdown b/History.markdown index 8006850..ee65066 100644 --- a/History.markdown +++ b/History.markdown @@ -26,6 +26,7 @@ * Fix locale specs that use the fallback locale (#360) * style: align with latest jekyll-rubocop (#382) * Profile plugin using a third-party repo (#414) + * Simplify conditional in SeoTag::Drop#date_modified (#343) ### Bug Fixes From 80da6a7da9165c2fa8168bf8cf216356d48f7dc9 Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Thu, 15 Oct 2020 19:29:48 +0530 Subject: [PATCH 11/31] Replace read-only empty hash with private constant (#418) Merge pull request 418 --- lib/jekyll-seo-tag/drop.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/jekyll-seo-tag/drop.rb b/lib/jekyll-seo-tag/drop.rb index 3ee277d..157babd 100644 --- a/lib/jekyll-seo-tag/drop.rb +++ b/lib/jekyll-seo-tag/drop.rb @@ -11,8 +11,11 @@ module Jekyll ].freeze HOMEPAGE_OR_ABOUT_REGEX = %r!^/(about/)?(index.html?)?$!.freeze + EMPTY_READ_ONLY_HASH = {}.freeze + private_constant :EMPTY_READ_ONLY_HASH + def initialize(text, context) - @obj = {} + @obj = EMPTY_READ_ONLY_HASH @mutations = {} @text = text @context = context @@ -236,7 +239,7 @@ module Jekyll if hash[key].is_a?(Hash) hash[key] else - {} + EMPTY_READ_ONLY_HASH end end end From 6f30b008451e42201e907cafd3b50ea6a42922f8 Mon Sep 17 00:00:00 2001 From: jekyllbot Date: Thu, 15 Oct 2020 09:59:50 -0400 Subject: [PATCH 12/31] Update history to reflect merge of #418 [ci skip] --- History.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/History.markdown b/History.markdown index ee65066..f3961c9 100644 --- a/History.markdown +++ b/History.markdown @@ -33,6 +33,7 @@ * Reduce allocations of instance-agnostic objects (#376) * Fix Travis builds for Jekyll 3.x ### -dev (#415) * Mutate hash literals instead of duplicating them (#417) + * Replace read-only empty hash with private constant (#418) ## 2.6.1 / 2019-05-17 From 8d509f261696ecb2ab72962ede7b7acec5dd4d49 Mon Sep 17 00:00:00 2001 From: Frank Taillandier Date: Sun, 18 Oct 2020 10:13:10 +0200 Subject: [PATCH 13/31] chore(deps): Ruby > 2.4 EOL --- .rubocop.yml | 4 ++-- jekyll-seo-tag.gemspec | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 8ed2cfa..7c33120 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -5,7 +5,7 @@ inherit_gem: rubocop-jekyll: .rubocop.yml AllCops: - TargetRubyVersion: 2.3 + TargetRubyVersion: 2.4 Exclude: - vendor/**/* @@ -14,6 +14,6 @@ Layout/LineLength: - spec/**/* - jekyll-seo-tag.gemspec -Layout/BlockLength: +Metrics/BlockLength: Exclude: - spec/**/* diff --git a/jekyll-seo-tag.gemspec b/jekyll-seo-tag.gemspec index 97a0232..17eb92d 100644 --- a/jekyll-seo-tag.gemspec +++ b/jekyll-seo-tag.gemspec @@ -19,14 +19,14 @@ Gem::Specification.new do |spec| raise "RubyGems 2.0 or newer is required to protect against public gem pushes." end - spec.required_ruby_version = ">= 2.3.0" + spec.required_ruby_version = ">= 2.4.0" spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r!^(test|spec|features)/!) } spec.bindir = "exe" spec.executables = spec.files.grep(%r!^exe/!) { |f| File.basename(f) } spec.require_paths = ["lib"] - spec.add_dependency "jekyll", ">= 3.3", "< 5.0" + spec.add_dependency "jekyll", ">= 3.8", "< 5.0" spec.add_development_dependency "bundler", ">= 1.15" spec.add_development_dependency "html-proofer", "~> 3.7" spec.add_development_dependency "rspec", "~> 3.5" From 20d61fa728b8114264c7e245071b0407cc5ac756 Mon Sep 17 00:00:00 2001 From: Frank Taillandier Date: Sun, 18 Oct 2020 10:24:32 +0200 Subject: [PATCH 14/31] chore(release): 2.7.0 --- History.markdown | 56 ++++++++++++++++++----------------- lib/jekyll-seo-tag/version.rb | 2 +- 2 files changed, 30 insertions(+), 28 deletions(-) diff --git a/History.markdown b/History.markdown index f3961c9..a963cb7 100644 --- a/History.markdown +++ b/History.markdown @@ -1,39 +1,41 @@ -## HEAD - -### Documentation - - * HTTPS links to schema.org (#350) - * use example.com for example URL (#351) - * remove Google+ from example snippet (#358) - * HTTPS link to https://ogp.me/ (#359) - * Rename Google webmaster tools to Google Search Console (#403) - * Improve documentation on plugin usage (#399) - * Structured Data Testing Tool is deprecated (#409) +## 2.7.0 / 2020-10-18 ### Minor Enhancements - * Adding possibility to change pagination message by config file (#324) + * Change pagination message with `seo_paginator_message` option (#324) * Make Twitter Summary Card without having Twitter account (#284) - * Ensure a single leading `@` for twitter usernames (#367) * Prefer site.tagline to site.description for page title (#356) - * chore(ci): bump Ruby versions (#385) * Render og:locale meta only when defined explicitly (#388) -### Development Fixes - - * Memoize #author_hash in SeoTag::AuthorDrop (#342) - * chore(ci): test Jekyll v4.0 (#372) - * Fix locale specs that use the fallback locale (#360) - * style: align with latest jekyll-rubocop (#382) - * Profile plugin using a third-party repo (#414) - * Simplify conditional in SeoTag::Drop#date_modified (#343) - ### Bug Fixes - * Reduce allocations of instance-agnostic objects (#376) - * Fix Travis builds for Jekyll 3.x ### -dev (#415) - * Mutate hash literals instead of duplicating them (#417) - * Replace read-only empty hash with private constant (#418) + * Ensure a single leading `@` for twitter usernames (#367) + +### Development Fixes + + * chore(deps): require Ruby > 2.4.0 EOL + * test: fix locale specs that use the fallback locale (#360) + * refactor: Replace read-only empty hash with private constant (#418) + * refactor: Mutate hash literals instead of duplicating them (#417) + * refactor: Reduce allocations of instance-agnostic objects (#376) + * refactor: Memoize #author_hash in SeoTag::AuthorDrop (#342) + * refactor: simplify conditional in SeoTag::Drop#date_modified (#343) + * chore(ci): profile seo-tag plugin on a third-party repository (#414) + * chore(ci): Jekyll v4.0 (#372) + * chore(ci): test against current stable Ruby 2.5 and 2.7 (#385) + * style: align with latest jekyll-rubocop (#382) + * fix: Travis builds for Jekyll 3.x (#415) + +### Documentation + + * Structured Data Testing Tool is deprecated (#409) + * Rename Google webmaster tools to Google Search Console (#403) + * Improve documentation on plugin usage (#399) + * remove Google+ from example snippet (#358) + * HTTPS link to https://ogp.me/ (#359) + * HTTPS links to schema.org (#350) + * use example.com for example URL (#351) + ## 2.6.1 / 2019-05-17 diff --git a/lib/jekyll-seo-tag/version.rb b/lib/jekyll-seo-tag/version.rb index 3a3808f..6a992c4 100644 --- a/lib/jekyll-seo-tag/version.rb +++ b/lib/jekyll-seo-tag/version.rb @@ -5,6 +5,6 @@ module Liquid; class Tag; end; end module Jekyll class SeoTag < Liquid::Tag - VERSION = "2.6.1" + VERSION = "2.7.0" end end From a1e0cdd25fda67f382553de758753838099959de Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Sun, 18 Oct 2020 14:06:55 +0530 Subject: [PATCH 15/31] Mutate site payload instead of duplicating it (#419) Merge pull request 419 --- lib/jekyll-seo-tag.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/jekyll-seo-tag.rb b/lib/jekyll-seo-tag.rb index 589fd13..2edafd7 100644 --- a/lib/jekyll-seo-tag.rb +++ b/lib/jekyll-seo-tag.rb @@ -47,12 +47,11 @@ module Jekyll def payload # site_payload is an instance of UnifiedPayloadDrop. See https://git.io/v5ajm - Jekyll::Utils.deep_merge_hashes( - context.registers[:site].site_payload, - "page" => context.registers[:page], - "paginator" => context["paginator"], - "seo_tag" => drop - ) + context.registers[:site].site_payload.tap do |site_payload| + site_payload["page"] = context.registers[:page] + site_payload["paginator"] = context["paginator"] + site_payload["seo_tag"] = drop + end end def drop From a7e1b5d8ec3bc8f387b7c8864cce42a3eed8e8c6 Mon Sep 17 00:00:00 2001 From: jekyllbot Date: Sun, 18 Oct 2020 04:36:57 -0400 Subject: [PATCH 16/31] Update history to reflect merge of #419 [ci skip] --- History.markdown | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/History.markdown b/History.markdown index a963cb7..f5c0aa7 100644 --- a/History.markdown +++ b/History.markdown @@ -1,3 +1,9 @@ +## HEAD + +### Development Fixes + + * Mutate site payload instead of duplicating it (#419) + ## 2.7.0 / 2020-10-18 ### Minor Enhancements @@ -36,7 +42,6 @@ * HTTPS links to schema.org (#350) * use example.com for example URL (#351) - ## 2.6.1 / 2019-05-17 ### Development Fixes From df294bb4911979722b00df12d9c6c0aa700b2cd9 Mon Sep 17 00:00:00 2001 From: Frank Taillandier Date: Sun, 18 Oct 2020 10:38:33 +0200 Subject: [PATCH 17/31] chore(release): v.2.7.1 :gem: --- History.markdown | 4 ++-- lib/jekyll-seo-tag/version.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/History.markdown b/History.markdown index f5c0aa7..ec18670 100644 --- a/History.markdown +++ b/History.markdown @@ -1,8 +1,8 @@ -## HEAD +## 2.7.1 / 2020-10-18 ### Development Fixes - * Mutate site payload instead of duplicating it (#419) + * refactor: mutate site payload instead of duplicating it (#419) ## 2.7.0 / 2020-10-18 diff --git a/lib/jekyll-seo-tag/version.rb b/lib/jekyll-seo-tag/version.rb index 6a992c4..7287eb5 100644 --- a/lib/jekyll-seo-tag/version.rb +++ b/lib/jekyll-seo-tag/version.rb @@ -5,6 +5,6 @@ module Liquid; class Tag; end; end module Jekyll class SeoTag < Liquid::Tag - VERSION = "2.7.0" + VERSION = "2.7.1" end end From 22a160cb32681a4349db7105626ad6aa0b1b2954 Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Mon, 26 Oct 2020 12:15:58 +0530 Subject: [PATCH 18/31] Remove redundant escapes inside regexp literal --- spec/jekyll_seo_tag_integration_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/jekyll_seo_tag_integration_spec.rb b/spec/jekyll_seo_tag_integration_spec.rb index 22646db..df2ebac 100755 --- a/spec/jekyll_seo_tag_integration_spec.rb +++ b/spec/jekyll_seo_tag_integration_spec.rb @@ -8,7 +8,7 @@ RSpec.describe Jekyll::SeoTag do let(:tag) { "seo" } let(:text) { "" } let(:output) { Liquid::Template.parse("{% #{tag} #{text} %}").render!(context, {}) } - let(:json) { output.match(%r!!m)[1] } + let(:json) { output.match(%r!!m)[1] } let(:json_data) { JSON.parse(json) } let(:paginator) { { "previous_page" => true, "previous_page_path" => "foo", "next_page" => true, "next_page_path" => "bar" } } From 9cb1ad0bd6ef941089de01c282c1771096bc65e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20Fr=C3=B6hner?= Date: Mon, 11 Jan 2021 17:13:50 +0100 Subject: [PATCH 19/31] Allow to set type for author (#427) Merge pull request 427 --- lib/jekyll-seo-tag/json_ld_drop.rb | 8 ++++++-- spec/jekyll_seo_tag/json_ld_drop_spec.rb | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/lib/jekyll-seo-tag/json_ld_drop.rb b/lib/jekyll-seo-tag/json_ld_drop.rb index 3bd1d46..88bb0e0 100644 --- a/lib/jekyll-seo-tag/json_ld_drop.rb +++ b/lib/jekyll-seo-tag/json_ld_drop.rb @@ -21,7 +21,8 @@ module Jekyll private :logo VALID_ENTITY_TYPES = %w(BlogPosting CreativeWork).freeze - private_constant :VALID_ENTITY_TYPES + VALID_AUTHOR_TYPES = %w(Organization Person).freeze + private_constant :VALID_ENTITY_TYPES, :VALID_AUTHOR_TYPES # page_drop should be an instance of Jekyll::SeoTag::Drop def initialize(page_drop) @@ -38,8 +39,11 @@ module Jekyll def author return unless page_drop.author["name"] + author_type = page_drop.author["type"] + return if author_type && !VALID_AUTHOR_TYPES.include?(author_type) + { - "@type" => "Person", + "@type" => author_type || "Person", "name" => page_drop.author["name"], } end diff --git a/spec/jekyll_seo_tag/json_ld_drop_spec.rb b/spec/jekyll_seo_tag/json_ld_drop_spec.rb index 68bd275..c40f4ed 100644 --- a/spec/jekyll_seo_tag/json_ld_drop_spec.rb +++ b/spec/jekyll_seo_tag/json_ld_drop_spec.rb @@ -72,6 +72,29 @@ RSpec.describe Jekyll::SeoTag::JSONLDDrop do end end end + + context "when type Organization" do + let(:author) { { "name" => "organization", "type" => "Organization" } } + + it "returns the author with type" do + expect(subject).to have_key("author") + expect(subject["author"]).to be_a(Hash) + expect(subject["author"]).to have_key("@type") + expect(subject["author"]["@type"]).to eql("Organization") + expect(subject["author"]).to have_key("name") + expect(subject["author"]["name"]).to be_a(String) + expect(subject["author"]["name"]).to eql("organization") + end + end + + context "when invalid type" do + let(:author) { { "name" => "organization", "type" => "Invalid" } } + + it "returns the author with type" do + expect(subject).to have_key("author") + expect(subject["author"]).to be nil + end + end end context "image" do From 93c664bce07aa290e141f15763dbfefe5de2744b Mon Sep 17 00:00:00 2001 From: jekyllbot Date: Mon, 11 Jan 2021 11:13:52 -0500 Subject: [PATCH 20/31] Update history to reflect merge of #427 [ci skip] --- History.markdown | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/History.markdown b/History.markdown index ec18670..2c1b440 100644 --- a/History.markdown +++ b/History.markdown @@ -1,3 +1,9 @@ +## HEAD + +### Minor Enhancements + + * Allow to set type for author (#427) + ## 2.7.1 / 2020-10-18 ### Development Fixes From d055720b4e685ee94a32f2f87fcb4048490e2ee8 Mon Sep 17 00:00:00 2001 From: Michael Currin <18750745+MichaelCurrin@users.noreply.github.com> Date: Wed, 1 Sep 2021 14:45:59 +0200 Subject: [PATCH 21/31] docs: fix typo (#449) Merge pull request 449 --- lib/jekyll-seo-tag/url_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/jekyll-seo-tag/url_helper.rb b/lib/jekyll-seo-tag/url_helper.rb index 68246cd..42bc803 100644 --- a/lib/jekyll-seo-tag/url_helper.rb +++ b/lib/jekyll-seo-tag/url_helper.rb @@ -8,8 +8,8 @@ module Jekyll # Determines if the given string is an absolute URL # - # Returns true if an absolute URL. - # Retruns false if it's a relative URL + # Returns true if an absolute URL + # Returns false if it's a relative URL # Returns nil if it is not a string or can't be parsed as a URL def absolute_url?(string) return unless string From 01fcf38c8b776655dd7d7d09009f5a4b06bca422 Mon Sep 17 00:00:00 2001 From: jekyllbot Date: Wed, 1 Sep 2021 08:46:00 -0400 Subject: [PATCH 22/31] Update history to reflect merge of #449 [ci skip] --- History.markdown | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/History.markdown b/History.markdown index 2c1b440..2b6643c 100644 --- a/History.markdown +++ b/History.markdown @@ -4,6 +4,10 @@ * Allow to set type for author (#427) +### Development Fixes + + * Fix typo in source code comment (#449) + ## 2.7.1 / 2020-10-18 ### Development Fixes From e3d0542ce6860bd6a6f348602d11131c372513bc Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Wed, 1 Sep 2021 20:17:50 +0530 Subject: [PATCH 23/31] Set up Continuous Integration via GH Actions (#450) Merge pull request 450 --- .github/workflows/ci.yml | 103 +++++++++++++++++++++++++++++++++++++++ .travis.yml | 18 ------- 2 files changed, 103 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..75291c8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,103 @@ +name: Continuous Integration + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + j4: + if: "!contains(github.event.commits[0].message, '[ci skip]')" + name: "Jekyll ${{ matrix.jekyll_version }} (Ruby ${{ matrix.ruby_version }})" + runs-on: 'ubuntu-latest' + env: + JEKYLL_VERSION: ${{ matrix.jekyll_version }} + strategy: + fail-fast: false + matrix: + ruby_version: + - 2.5 + - 2.7 + - 3.0 + jekyll_version: + - "~> 4.0" + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 5 + - name: "Set up Ruby ${{ matrix.ruby_version }}" + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby_version }} + bundler-cache: true + - name: Execute tests + run: bundle exec rspec + j3: + if: "!contains(github.event.commits[0].message, '[ci skip]')" + name: "Jekyll ${{ matrix.jekyll_version }} (Ruby ${{ matrix.ruby_version }})" + runs-on: 'ubuntu-latest' + env: + JEKYLL_VERSION: ${{ matrix.jekyll_version }} + strategy: + fail-fast: false + matrix: + ruby_version: + - 2.5 + jekyll_version: + - "~> 3.9" + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 5 + - name: "Set up Ruby ${{ matrix.ruby_version }}" + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby_version }} + bundler-cache: true + - name: Execute tests + run: bundle exec rspec + + style_check: + if: "!contains(github.event.commits[0].message, '[ci skip]')" + name: "Code Style Check (Ruby ${{ matrix.ruby_version }})" + runs-on: 'ubuntu-latest' + strategy: + fail-fast: false + matrix: + ruby_version: + - 2.5 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 5 + - name: "Set up Ruby ${{ matrix.ruby_version }}" + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby_version }} + bundler-cache: true + - name: Check Style Offenses + run: bundle exec rubocop -S -D + + gem_build: + if: "!contains(github.event.commits[0].message, '[ci skip]')" + name: "Test Gem build (Ruby ${{ matrix.ruby_version }})" + runs-on: 'ubuntu-latest' + strategy: + fail-fast: false + matrix: + ruby_version: + - 2.5 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 5 + - name: "Set up Ruby ${{ matrix.ruby_version }}" + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby_version }} + bundler-cache: true + - name: Test Gem build + run: bundle exec gem build jekyll-seo-tag.gemspec diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d5ffa5c..0000000 --- a/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: ruby -cache: bundler -rvm: - - 2.5 - - 2.7 - -before_install: - - gem update --system - - gem install bundler - -script: script/cibuild - -env: - global: - - NOKOGIRI_USE_SYSTEM_LIBRARIES=true - matrix: - - JEKYLL_VERSION="~> 3.9" - - JEKYLL_VERSION="~> 4.0" From 7b5478a24972d74a633513610802d13da225bc64 Mon Sep 17 00:00:00 2001 From: jekyllbot Date: Wed, 1 Sep 2021 10:47:51 -0400 Subject: [PATCH 24/31] Update history to reflect merge of #450 [ci skip] --- History.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/History.markdown b/History.markdown index 2b6643c..0840522 100644 --- a/History.markdown +++ b/History.markdown @@ -7,6 +7,7 @@ ### Development Fixes * Fix typo in source code comment (#449) + * Set up Continuous Integration via GH Actions (#450) ## 2.7.1 / 2020-10-18 From e1a60e2fdf38fa8a345dd87ee10a220201fb4713 Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Fri, 17 Sep 2021 12:54:01 +0530 Subject: [PATCH 25/31] Update third-party repo profile workflow config * Set ruby_version via `strategy.matrix`. * Migrate to `ruby/setup-ruby` action. * Use double-quoted strings consistently. --- .github/workflows/third-party.yml | 38 +++++++++++++++---------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/.github/workflows/third-party.yml b/.github/workflows/third-party.yml index e450e8a..0348108 100644 --- a/.github/workflows/third-party.yml +++ b/.github/workflows/third-party.yml @@ -10,7 +10,18 @@ on: jobs: build_n_profile: if: "!contains(github.event.commits[0].message, '[ci skip]')" - runs-on: 'ubuntu-latest' + name: "Third-Party Repo Profile (Ruby ${{ matrix.ruby_version }})" + runs-on: "ubuntu-latest" + strategy: + fail-fast: false + matrix: + ruby_version: + - 2.7 + env: + BUNDLE_GEMFILE: "sandbox/Gemfile" + BUNDLE_PATH: "vendor/bundle" + BUNDLE_JOBS: 4 + BUNDLE_RETRY: 3 steps: - name: Checkout Jekyll SEO Tag uses: actions/checkout@v2 @@ -21,32 +32,19 @@ jobs: uses: actions/checkout@v2 with: repository: ashmaroli/tomjoht.github.io - ref: 'no-seo-tag' + ref: "no-seo-tag" path: alpha-sandbox - name: Checkout Same Third-Party Repository (WITH SEO Tag) uses: actions/checkout@v2 with: repository: ashmaroli/tomjoht.github.io - ref: 'seo-tag' + ref: "seo-tag" path: sandbox - - name: Set up Ruby - uses: actions/setup-ruby@v1 + - name: "Set up Ruby ${{ matrix.ruby_version }}" + uses: ruby/setup-ruby@v1 with: - ruby-version: 2.6.x - - name: Set up Dependencies Cache - uses: actions/cache@v1 - with: - path: sandbox/vendor/bundle - key: ubuntu-latest-gems- - restore-keys: | - ubuntu-latest-gems- - - name: Set up Dependencies - run: | - gem update --system --no-document - gem update bundler --no-document - bundle config gemfile sandbox/Gemfile - bundle config path vendor/bundle - bundle install --jobs 4 --retry 3 + ruby-version: ${{ matrix.ruby_version }} + bundler-cache: true - name: Run Jekyll Build (WITHOUT SEO Tag) 3 times run: | bundle exec jekyll build -s alpha-sandbox -d alpha-sandbox/_site --trace From 6c387eaeb4e6e86ec19ca84f1dbdbc7411b1d523 Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Fri, 17 Sep 2021 19:49:57 +0530 Subject: [PATCH 26/31] Bump RuboCop to v1.18.x (#452) Merge pull request 452 --- .rubocop.yml | 25 +++++++++++++++++- .rubocop_todo.yml | 35 ++++++++++++++++++++++++- jekyll-seo-tag.gemspec | 4 +-- lib/jekyll-seo-tag/author_drop.rb | 8 +++--- lib/jekyll-seo-tag/image_drop.rb | 8 +++--- lib/jekyll-seo-tag/json_ld_drop.rb | 7 +++-- spec/jekyll_seo_tag_integration_spec.rb | 3 ++- 7 files changed, 73 insertions(+), 17 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 7c33120..6688e6d 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -5,15 +5,38 @@ inherit_gem: rubocop-jekyll: .rubocop.yml AllCops: - TargetRubyVersion: 2.4 + TargetRubyVersion: 2.5 + SuggestExtensions: false Exclude: - vendor/**/* +Layout/LineEndStringConcatenationIndentation: + Enabled: true Layout/LineLength: Exclude: - spec/**/* - jekyll-seo-tag.gemspec +Lint/EmptyInPattern: + Enabled: false + Metrics/BlockLength: Exclude: - spec/**/* + +Naming/InclusiveLanguage: + Enabled: false + +Performance/MapCompact: + Enabled: true +Performance/RedundantEqualityComparisonBlock: + Enabled: true +Performance/RedundantSplitRegexpArgument: + Enabled: true + +Style/InPatternThen: + Enabled: false +Style/MultilineInPatternThen: + Enabled: false +Style/QuotedSymbols: + Enabled: true diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index cb469c1..59fd59b 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,13 +1,46 @@ # This configuration was generated by # `rubocop --auto-gen-config --auto-gen-only-exclude` -# on 2020-03-20 11:41:46 +0100 using RuboCop version 0.80.1. +# on 2021-09-17 06:40:32 UTC using RuboCop version 1.18.4. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. +# Offense count: 1 +# Configuration parameters: AllowComments. +Lint/EmptyClass: + Exclude: + - 'lib/jekyll-seo-tag/version.rb' + +# Offense count: 3 +Lint/NoReturnInBeginEndBlocks: + Exclude: + - 'lib/jekyll-seo-tag/author_drop.rb' + - 'lib/jekyll-seo-tag/drop.rb' + # Offense count: 1 # Cop supports --auto-correct. Lint/ToJSON: Exclude: - 'lib/jekyll-seo-tag/json_ld_drop.rb' + +# Offense count: 1 +# Configuration parameters: IgnoredMethods, Max. +Metrics/PerceivedComplexity: + Exclude: + - 'lib/jekyll-seo-tag/drop.rb' + +# Offense count: 1 +# Configuration parameters: MinSize. +Performance/CollectionLiteralInLoop: + Exclude: + - 'spec/jekyll_seo_tag/author_drop_spec.rb' + +# Offense count: 9 +# Cop supports --auto-correct. +Style/RedundantBegin: + Exclude: + - 'lib/jekyll-seo-tag.rb' + - 'lib/jekyll-seo-tag/author_drop.rb' + - 'lib/jekyll-seo-tag/drop.rb' + - 'lib/jekyll-seo-tag/image_drop.rb' diff --git a/jekyll-seo-tag.gemspec b/jekyll-seo-tag.gemspec index 17eb92d..487444b 100644 --- a/jekyll-seo-tag.gemspec +++ b/jekyll-seo-tag.gemspec @@ -19,7 +19,7 @@ Gem::Specification.new do |spec| raise "RubyGems 2.0 or newer is required to protect against public gem pushes." end - spec.required_ruby_version = ">= 2.4.0" + spec.required_ruby_version = ">= 2.5.0" spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r!^(test|spec|features)/!) } spec.bindir = "exe" @@ -30,5 +30,5 @@ Gem::Specification.new do |spec| spec.add_development_dependency "bundler", ">= 1.15" spec.add_development_dependency "html-proofer", "~> 3.7" spec.add_development_dependency "rspec", "~> 3.5" - spec.add_development_dependency "rubocop-jekyll", "~> 0.11" + spec.add_development_dependency "rubocop-jekyll", "~> 0.12.0" end diff --git a/lib/jekyll-seo-tag/author_drop.rb b/lib/jekyll-seo-tag/author_drop.rb index 2baa95e..9d534cb 100644 --- a/lib/jekyll-seo-tag/author_drop.rb +++ b/lib/jekyll-seo-tag/author_drop.rb @@ -41,8 +41,7 @@ module Jekyll private - attr_reader :page - attr_reader :site + attr_reader :site, :page # Finds the page author in the page.author, page.authors, or site.author # @@ -75,9 +74,10 @@ module Jekyll # or an empty hash, if the author cannot be resolved def author_hash @author_hash ||= begin - if resolved_author.is_a? Hash + case resolved_author + when Hash resolved_author - elsif resolved_author.is_a? String + when String { "name" => resolved_author }.merge!(site_data_hash) else {} diff --git a/lib/jekyll-seo-tag/image_drop.rb b/lib/jekyll-seo-tag/image_drop.rb index 5427353..43367a4 100644 --- a/lib/jekyll-seo-tag/image_drop.rb +++ b/lib/jekyll-seo-tag/image_drop.rb @@ -34,17 +34,17 @@ module Jekyll private - attr_accessor :page - attr_accessor :context + attr_accessor :page, :context # The normalized image hash with a `path` key (which may be nil) def image_hash @image_hash ||= begin image_meta = page["image"] - if image_meta.is_a?(Hash) + case image_meta + when Hash { "path" => nil }.merge!(image_meta) - elsif image_meta.is_a?(String) + when String { "path" => image_meta } else { "path" => nil } diff --git a/lib/jekyll-seo-tag/json_ld_drop.rb b/lib/jekyll-seo-tag/json_ld_drop.rb index 88bb0e0..11d04e3 100644 --- a/lib/jekyll-seo-tag/json_ld_drop.rb +++ b/lib/jekyll-seo-tag/json_ld_drop.rb @@ -16,9 +16,8 @@ module Jekyll def_delegator :page_drop, :type, :type # Expose #type and #logo as private methods and #@type as a public method - alias_method :"@type", :type - private :type - private :logo + alias_method :@type, :type + private :type, :logo VALID_ENTITY_TYPES = %w(BlogPosting CreativeWork).freeze VALID_AUTHOR_TYPES = %w(Organization Person).freeze @@ -84,7 +83,7 @@ module Jekyll private :main_entity def to_json - to_h.reject { |_k, v| v.nil? }.to_json + to_h.compact.to_json end private diff --git a/spec/jekyll_seo_tag_integration_spec.rb b/spec/jekyll_seo_tag_integration_spec.rb index df2ebac..b0b9d26 100755 --- a/spec/jekyll_seo_tag_integration_spec.rb +++ b/spec/jekyll_seo_tag_integration_spec.rb @@ -26,7 +26,8 @@ RSpec.describe Jekyll::SeoTag do end it "outputs meta generator" do - expect(output).to match(%r!Jekyll v#{Jekyll::VERSION}!i) + version = Jekyll::VERSION + expect(output).to match(%r!Jekyll v#{version}!i) end it "outputs valid HTML" do From 7c0d75a29b9f48af44657a17cce29e386f370cf2 Mon Sep 17 00:00:00 2001 From: jekyllbot Date: Fri, 17 Sep 2021 10:19:58 -0400 Subject: [PATCH 27/31] Update history to reflect merge of #452 [ci skip] --- History.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/History.markdown b/History.markdown index 0840522..5e94420 100644 --- a/History.markdown +++ b/History.markdown @@ -8,6 +8,7 @@ * Fix typo in source code comment (#449) * Set up Continuous Integration via GH Actions (#450) + * Bump RuboCop to v1.18.x (#452) ## 2.7.1 / 2020-10-18 From b5c53de8f04520b8807baca28830ceb908641dd7 Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Thu, 7 Oct 2021 22:53:32 +0530 Subject: [PATCH 28/31] Profile with multiple Jekyll versions --- .github/workflows/third-party.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/third-party.yml b/.github/workflows/third-party.yml index 0348108..1a67494 100644 --- a/.github/workflows/third-party.yml +++ b/.github/workflows/third-party.yml @@ -9,19 +9,22 @@ on: - master jobs: build_n_profile: - if: "!contains(github.event.commits[0].message, '[ci skip]')" - name: "Third-Party Repo Profile (Ruby ${{ matrix.ruby_version }})" + name: "Third-Party Repo Profile with Jekyll ${{ matrix.jekyll_version }} (Ruby ${{ matrix.ruby_version }})" runs-on: "ubuntu-latest" strategy: fail-fast: false matrix: ruby_version: - 2.7 + jekyll_version: + - "~> 4.0" + - "~> 3.9" env: BUNDLE_GEMFILE: "sandbox/Gemfile" BUNDLE_PATH: "vendor/bundle" BUNDLE_JOBS: 4 BUNDLE_RETRY: 3 + JEKYLL_VERSION: ${{ matrix.jekyll_version }} steps: - name: Checkout Jekyll SEO Tag uses: actions/checkout@v2 From be9ce5d13e35f5560bd43853cac0f0f5a48ce1c2 Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Thu, 7 Oct 2021 23:18:54 +0530 Subject: [PATCH 29/31] Profile using an intermediate shell script --- .github/workflows/scripts/memprof | 4 ++++ .github/workflows/{actions => scripts}/memprof.rb | 0 .github/workflows/third-party.yml | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/scripts/memprof rename .github/workflows/{actions => scripts}/memprof.rb (100%) diff --git a/.github/workflows/scripts/memprof b/.github/workflows/scripts/memprof new file mode 100644 index 0000000..2f06786 --- /dev/null +++ b/.github/workflows/scripts/memprof @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +bundle exec ruby jekyll-seo-tag/.github/workflows/scripts/memprof.rb sandbox +exit 0 diff --git a/.github/workflows/actions/memprof.rb b/.github/workflows/scripts/memprof.rb similarity index 100% rename from .github/workflows/actions/memprof.rb rename to .github/workflows/scripts/memprof.rb diff --git a/.github/workflows/third-party.yml b/.github/workflows/third-party.yml index 1a67494..aa773f3 100644 --- a/.github/workflows/third-party.yml +++ b/.github/workflows/third-party.yml @@ -59,4 +59,4 @@ jobs: bundle exec jekyll build -s sandbox -d sandbox/_site --trace bundle exec jekyll build -s sandbox -d sandbox/_site --trace - name: Memory Analysis of Jekyll Build (WITH SEO Tag) - run: bundle exec ruby jekyll-seo-tag/.github/workflows/actions/memprof.rb sandbox + run: bash jekyll-seo-tag/.github/workflows/scripts/memprof From 8b5d2901c262c6f9e97dcb1bfc473bd4250c5ea8 Mon Sep 17 00:00:00 2001 From: Ilgiz Mustafin Date: Fri, 8 Oct 2021 08:50:06 +0300 Subject: [PATCH 30/31] Allow setting `author.url` (#453) Merge pull request 453 --- docs/advanced-usage.md | 12 ++++++++++++ lib/jekyll-seo-tag/json_ld_drop.rb | 7 ++++++- spec/jekyll_seo_tag/json_ld_drop_spec.rb | 15 +++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/docs/advanced-usage.md b/docs/advanced-usage.md index a0d0a57..e534abd 100644 --- a/docs/advanced-usage.md +++ b/docs/advanced-usage.md @@ -68,6 +68,18 @@ There are several ways to convey this author-specific information. Author inform author: benbalter ``` +#### Setting author url + +Starting from August 6, 2021 [Google recommends](https://developers.google.com/search/updates) to set the `author.url` property. This property helps Google to disambiguate the correct author of the article. + +You can set it the same way as the other author properties. For example, you can put it in an `author` object, in the site's `_config.yml`, e.g.: + + ```yml + author: + name: My Name + url: https://example.com/ + ``` + ### Customizing JSON-LD output The following options can be set for any particular page. While the default options are meant to serve most users in the most common circumstances, there may be situations where more precise control is necessary. diff --git a/lib/jekyll-seo-tag/json_ld_drop.rb b/lib/jekyll-seo-tag/json_ld_drop.rb index 11d04e3..c892895 100644 --- a/lib/jekyll-seo-tag/json_ld_drop.rb +++ b/lib/jekyll-seo-tag/json_ld_drop.rb @@ -41,10 +41,15 @@ module Jekyll author_type = page_drop.author["type"] return if author_type && !VALID_AUTHOR_TYPES.include?(author_type) - { + hash = { "@type" => author_type || "Person", "name" => page_drop.author["name"], } + + author_url = page_drop.author["url"] + hash["url"] = author_url if author_url + + hash end def image diff --git a/spec/jekyll_seo_tag/json_ld_drop_spec.rb b/spec/jekyll_seo_tag/json_ld_drop_spec.rb index c40f4ed..3f1b5ff 100644 --- a/spec/jekyll_seo_tag/json_ld_drop_spec.rb +++ b/spec/jekyll_seo_tag/json_ld_drop_spec.rb @@ -69,6 +69,7 @@ RSpec.describe Jekyll::SeoTag::JSONLDDrop do expect(subject["author"]).to have_key("name") expect(subject["author"]["name"]).to be_a(String) expect(subject["author"]["name"]).to eql("author") + expect(subject["author"]["url"]).to be nil end end end @@ -95,6 +96,20 @@ RSpec.describe Jekyll::SeoTag::JSONLDDrop do expect(subject["author"]).to be nil end end + + context "when url is present" do + let(:author) { { "name" => "author", "url" => "https://example.com" } } + + it "returns the author with url" do + expect(subject).to have_key("author") + expect(subject["author"]).to be_a(Hash) + expect(subject["author"]).to have_key("url") + expect(subject["author"]["url"]).to eql("https://example.com") + expect(subject["author"]).to have_key("name") + expect(subject["author"]["name"]).to be_a(String) + expect(subject["author"]["name"]).to eql("author") + end + end end context "image" do From dff018c347d81c26d61a3270cb175c37231a5301 Mon Sep 17 00:00:00 2001 From: jekyllbot Date: Fri, 8 Oct 2021 01:50:07 -0400 Subject: [PATCH 31/31] Update history to reflect merge of #453 [ci skip] --- History.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/History.markdown b/History.markdown index 5e94420..5f13ab2 100644 --- a/History.markdown +++ b/History.markdown @@ -3,6 +3,7 @@ ### Minor Enhancements * Allow to set type for author (#427) + * Allow setting `author.url` (#453) ### Development Fixes