Merge pull request #60 from boturnbow/master

Update JSON-LD output to current usage for site logo and page image
This commit is contained in:
Ben Balter 2016-03-05 14:12:42 -05:00
commit 12bac4b9ea
2 changed files with 17 additions and 8 deletions

View File

@ -84,6 +84,14 @@
{% assign seo_links = site.social.links %}
{% endif %}
{% if site.logo %}
{% assign seo_site_logo = site.logo | prepend: seo_url | escape %}
{% endif %}
{% if page.image %}
{% assign seo_page_image = page.image | prepend: seo_url | escape %}
{% endif %}
{% if seo_tag.title and seo_title %}
<title>{{ seo_title }}</title>
{% endif %}
@ -106,8 +114,8 @@
<meta property="og:site_name" content="{{ seo_site_title }}" />
{% endif %}
{% if page.image %}
<meta property="og:image" content="{{ page.image | prepend: seo_url | escape }}" />
{% if seo_page_image %}
<meta property="og:image" content="{{ seo_page_image }}" />
{% endif %}
{% if page.date %}
@ -162,8 +170,8 @@
"headline": {{ seo_page_title | jsonify }},
{% endif %}
{% if page.image %}
"image": {{ page.image | jsonify }},
{% if seo_page_image %}
"image": {{ seo_page_image | jsonify }},
{% endif %}
{% if page.date %}
@ -174,8 +182,8 @@
"description": {{ seo_description | jsonify }},
{% endif %}
{% if site.logo %}
"logo": {{ site.logo | prepend: "/" | prepend: seo_url | jsonify }},
{% if seo_site_logo %}
"logo": {{ seo_site_logo | jsonify }},
{% endif %}
{% if seo_links %}

View File

@ -120,7 +120,7 @@ describe Jekyll::SeoTag do
end
context 'with site.logo' do
let(:site) { make_site('logo' => 'logo.png', 'url' => 'http://example.invalid') }
let(:site) { make_site('logo' => '/logo.png', 'url' => 'http://example.invalid') }
it 'outputs the logo' do
expect(json_data['logo']).to eql('http://example.invalid/logo.png')
@ -163,6 +163,7 @@ EOS
context 'posts' do
context 'with post meta' do
let(:site) { make_site('url' => 'http://example.invalid') }
let(:meta) do
{
'title' => 'post',
@ -178,7 +179,7 @@ EOS
expect(json_data['headline']).to eql('post')
expect(json_data['description']).to eql('description')
expect(json_data['image']).to eql('/img.png')
expect(json_data['image']).to eql('http://example.invalid/img.png')
end
it 'minifies JSON-LD' do