diff --git a/lib/template.html b/lib/template.html
index 2bce881..5a28563 100644
--- a/lib/template.html
+++ b/lib/template.html
@@ -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 %}
diff --git a/spec/jekyll_seo_tag_spec.rb b/spec/jekyll_seo_tag_spec.rb
index 61c5b43..a065e7f 100644
--- a/spec/jekyll_seo_tag_spec.rb
+++ b/spec/jekyll_seo_tag_spec.rb
@@ -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