Merge pull request #185 from aav7fl/master

Fix issue #183 image.itemtype
This commit is contained in:
Ben Balter 2017-04-11 16:21:08 -05:00 committed by GitHub
commit a877451879
2 changed files with 19 additions and 0 deletions

View File

@ -223,7 +223,16 @@
{% endif %}
{% if seo_page_image %}
{% if page.image.height && page.image.width %}
"image": {
"@type": "ImageObject",
"url": {{ seo_page_image | jsonify }},
"height": {{ page.image.height | jsonify }},
"width": {{ page.image.width | jsonify }}
},
{% else %}
"image": {{ seo_page_image | jsonify }},
{% endif %}
{% endif %}
{% if page.date %}

View File

@ -195,6 +195,10 @@ describe Jekyll::SeoTag do
expected = %r!<meta property="og:image" content="http://example.invalid/img/foo.png" />!
expect(output).to match(expected)
end
it "outputs the image JSON item" do
expect(json_data["image"]).to eql("http://example.invalid/img/foo.png")
end
end
context "when given a facebook image" do
@ -225,6 +229,12 @@ describe Jekyll::SeoTag do
expected = %r!<meta property="og:image:width" content="2" />!
expect(output).to match(expected)
end
it "outputs the image JSON object with dimensions" do
expect(json_data["image"]["url"]).to eql("http://example.invalid/img/foo.png")
expect(json_data["image"]["height"]).to eql(1)
expect(json_data["image"]["width"]).to eql(2)
end
end
end