diff --git a/lib/template.html b/lib/template.html index dca838e..fb14581 100644 --- a/lib/template.html +++ b/lib/template.html @@ -165,7 +165,7 @@ {% if page.seo and page.seo.links %} "sameAs" : {{ page.seo.links | jsonify }}, -{% elsif page.url == "/" and site.social and site.social.links %} +{% elsif (page.url == "/" or page.url == "/about/") and site.social and site.social.links %} "sameAs" : {{ site.social.links | jsonify }}, {% endif %} diff --git a/spec/jekyll_seo_tag_spec.rb b/spec/jekyll_seo_tag_spec.rb index cef607e..301d024 100644 --- a/spec/jekyll_seo_tag_spec.rb +++ b/spec/jekyll_seo_tag_spec.rb @@ -251,20 +251,39 @@ describe Jekyll::SeoTag do let(:links) { ['http://foo.invalid', 'http://bar.invalid'] } let(:social_namespace) { { 'name' => 'Ben', 'links' => links } } let(:site) { make_site('social' => social_namespace) } - let(:meta) do - { - 'permalink' => '/', - 'seo' => { - 'type' => 'person' - } - } - end let(:page) { make_post(meta) } - it 'outputs social meta' do - expect(json_data['@type']).to eql('person') - expect(json_data['name']).to eql('Ben') - expect(json_data['sameAs']).to eql(links) + context 'on homepage' do + let(:meta) do + { + 'permalink' => '/', + 'seo' => { + 'type' => 'person' + } + } + end + + it 'outputs social meta' do + expect(json_data['@type']).to eql('person') + expect(json_data['name']).to eql('Ben') + expect(json_data['sameAs']).to eql(links) + end + end + + context 'on about page' do + let(:meta) { { 'permalink' => '/about/' } } + + it 'outputs sameAs links' do + expect(json_data['sameAs']).to eql(links) + end + end + + context 'on other pages' do + let(:meta) { { 'permalink' => '/2/' } } + + it 'does not output sameAs links' do + expect(json_data['sameAs']).to be_nil + end end end