Implement PR #103 for my own use. Change template to better fit existing style.

This commit is contained in:
kyle 2017-01-25 11:35:18 -05:00
parent fd5246a4cd
commit 5437934214
2 changed files with 9 additions and 22 deletions

View File

@ -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 @@
<meta property="og:title" content="{{ seo_page_title }}" />
{% endif %}
{% if seo_author %}
<meta name="author" content="{{ seo_author }}" />
{% endif %}
{% if seo_description %}
<meta name="description" content="{{ seo_description }}" />
<meta property="og:description" content="{{ 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",

View File

@ -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/") }