From 543793421414b6fdb98a85c3fc4510eaf0c812fd Mon Sep 17 00:00:00 2001 From: kyle Date: Wed, 25 Jan 2017 11:35:18 -0500 Subject: [PATCH] Implement PR #103 for my own use. Change template to better fit existing style. --- lib/template.html | 15 ++++++++------- spec/jekyll_seo_tag_spec.rb | 16 +--------------- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/lib/template.html b/lib/template.html index 5a28563..e4baf2d 100644 --- a/lib/template.html +++ b/lib/template.html @@ -62,9 +62,6 @@ {% endif %} {% endif %} {% assign seo_author_twitter = seo_author_twitter | replace:"@","" %} - {% if seo_author %} - {% assign seo_author_name = seo_author.name | default: seo_author %} - {% endif %} {% endif %} {% if page.seo and page.seo.type %} @@ -107,6 +104,10 @@ {% endif %} +{% if seo_author %} + +{% endif %} + {% if seo_description %} @@ -209,10 +210,10 @@ "headline": {{ seo_page_title | jsonify }}, {% endif %} -{% if seo_author_name %} +{% if seo_author %} "author": { "@type": "Person", - "name": {{ seo_author_name | jsonify }} + "name": {{ seo_author | jsonify }} }, {% endif %} @@ -246,8 +247,8 @@ {% if seo_site_logo %} "publisher": { "@type": "Organization", - {% if seo_author_name %} - "name": {{ seo_author_name | jsonify }}, + {% if seo_author %} + "name": {{ seo_author | jsonify }}, {% endif %} "logo": { "@type": "ImageObject", diff --git a/spec/jekyll_seo_tag_spec.rb b/spec/jekyll_seo_tag_spec.rb index a065e7f..6ffbf4f 100644 --- a/spec/jekyll_seo_tag_spec.rb +++ b/spec/jekyll_seo_tag_spec.rb @@ -226,7 +226,7 @@ describe Jekyll::SeoTag do end end - context "with page.author.name" do + context "with page.author" do let(:site) { make_site("logo" => "/logo.png", "url" => "http://example.invalid") } let(:page) { make_post("author" => "Mr. Foo") } @@ -240,20 +240,6 @@ describe Jekyll::SeoTag do end end - context "with only page.author" do - let(:site) { make_site("logo" => "/logo.png", "url" => "http://example.invalid") } - let(:page) { make_post("author" => { "name" => "Mr. Foo" }) } - - it "outputs the author" do - expect(json_data["author"]["@type"]).to eql("Person") - expect(json_data["author"]["name"]).to eql("Mr. Foo") - end - - it "outputs the publisher author" do - expect(json_data["publisher"]["name"]).to eql("Mr. Foo") - end - end - context "with seo type is BlogPosting" do let(:site) { make_site("url" => "http://example.invalid") } let(:page) { make_post("seo" => { "type" => "BlogPosting" }, "permalink" => "/foo/") }