From 4c577ffb47b84fc293e1ff44e6374fa9174681e1 Mon Sep 17 00:00:00 2001 From: Kyle Niewiada Date: Fri, 17 Feb 2017 10:30:44 -0500 Subject: [PATCH] Add legacy test and maintain old methods --- lib/template.html | 4 ++-- spec/jekyll_seo_tag_spec.rb | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/template.html b/lib/template.html index ebc0697..41bc2b0 100755 --- a/lib/template.html +++ b/lib/template.html @@ -115,8 +115,8 @@ {% assign seo_page_image_facebook = seo_page_image_facebook | absolute_url %} {% endunless %} {% assign seo_page_image_facebook = seo_page_image_facebook | escape %} - {% assign seo_page_image_facebook_width = page.image.facebook.width %} - {% assign seo_page_image_facebook_height = page.image.facebook.height %} + {% assign seo_page_image_facebook_width = page.image.facebook.width | default: page.image.width %} + {% assign seo_page_image_facebook_height = page.image.facebook.height | default: page.image.height %} {% assign seo_page_image_twitter = page.image.twitter.path | default: page.image.twitter %} {% unless seo_page_image_twitter contains "://" %} diff --git a/spec/jekyll_seo_tag_spec.rb b/spec/jekyll_seo_tag_spec.rb index 8637da4..929c5ad 100644 --- a/spec/jekyll_seo_tag_spec.rb +++ b/spec/jekyll_seo_tag_spec.rb @@ -177,6 +177,17 @@ describe Jekyll::SeoTag do expect(output).to match(expected) end end + + context "when given the image height and width (legacy)" do + let(:page) { make_page("image" => { "facebook" => "/img/foo.png", "height" => 1, "width" => 2 } ) } + + it "outputs the image" do + expected = %r!! + expect(output).to match(expected) + expected = %r!! + expect(output).to match(expected) + end + end end context "with site.logo" do