Test output manually with Google Markup. Change inferred type. Improve test coverage

This commit is contained in:
kyle 2017-01-25 11:05:38 -05:00
parent b04f73960e
commit fd5246a4cd
2 changed files with 12 additions and 7 deletions

View File

@ -63,7 +63,7 @@
{% endif %}
{% assign seo_author_twitter = seo_author_twitter | replace:"@","" %}
{% if seo_author %}
{% assign seo_author_name = seo_author %}
{% assign seo_author_name = seo_author.name | default: seo_author %}
{% endif %}
{% endif %}
@ -210,7 +210,10 @@
{% endif %}
{% if seo_author_name %}
"author": {{ seo_author_name | jsonify }},
"author": {
"@type": "Person",
"name": {{ seo_author_name | jsonify }}
},
{% endif %}
{% if seo_page_image %}

View File

@ -226,12 +226,13 @@ describe Jekyll::SeoTag do
end
end
context "with page.author" do
context "with page.author.name" do
let(:site) { make_site("logo" => "/logo.png", "url" => "http://example.invalid") }
let(:page) { make_post("author" => "Mr. Foo") }
it "outputs the author" do
expect(json_data["author"]).to eql("Mr. Foo")
expect(json_data["author"]["@type"]).to eql("Person")
expect(json_data["author"]["name"]).to eql("Mr. Foo")
end
it "outputs the publisher author" do
@ -239,12 +240,13 @@ describe Jekyll::SeoTag do
end
end
context "with page.author" do
context "with only page.author" do
let(:site) { make_site("logo" => "/logo.png", "url" => "http://example.invalid") }
let(:page) { make_post("author" => "Mr. Foo") }
let(:page) { make_post("author" => { "name" => "Mr. Foo" }) }
it "outputs the author" do
expect(json_data["author"]).to eql("Mr. Foo")
expect(json_data["author"]["@type"]).to eql("Person")
expect(json_data["author"]["name"]).to eql("Mr. Foo")
end
it "outputs the publisher author" do