Include sameAs links on About page

This commit is contained in:
Pat Hawks 2016-02-22 18:13:43 -08:00
parent f193c6fb39
commit f3e0e78993
No known key found for this signature in database
GPG Key ID: F1746FF5F18B3D1B
2 changed files with 32 additions and 13 deletions

View File

@ -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 %}

View File

@ -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