Update docs. Add use case. Add test.

This commit is contained in:
Kyle Niewiada 2017-02-15 12:41:30 -05:00
parent cc02710dbf
commit 8e36fe4da1
3 changed files with 12 additions and 3 deletions

View File

@ -215,10 +215,9 @@ Or if you have no site specific images simply:
```yml
image:
path: /img/banner.png
height: 100
width: 100
```
> Using the image dimensions are optional, but the [Google Structured Data Testing Tool](https://search.google.com/structured-data/testing-tool/u/0/) will consider the JSON-LD to have errors when an image does not have specified dimensions.
### Setting a default image

View File

@ -266,7 +266,7 @@
},
{% endif %}
{% if seo_type == "BlogPosting" %}
{% if seo_type == "BlogPosting" or seo_type == "CreativeWork" %}
"mainEntityOfPage": {
"@type": "WebPage",
"@id": {{ page.url | replace:'/index.html','/' | absolute_url | jsonify }}

View File

@ -250,6 +250,16 @@ describe Jekyll::SeoTag do
end
end
context "with seo type is CreativeWork" do
let(:site) { make_site("url" => "http://example.invalid") }
let(:page) { make_post("seo" => { "type" => "CreativeWork" }, "permalink" => "/foo/") }
it "outputs the mainEntityOfPage" do
expect(json_data["mainEntityOfPage"]["@type"]).to eql("WebPage")
expect(json_data["mainEntityOfPage"]["@id"]).to eql("http://example.invalid/foo/")
end
end
context "with site.title" do
let(:site) { make_site("title" => "Foo", "url" => "http://example.invalid") }