Merge pull request #72 from jekyll/pr/twitter_large_image

Large image summary Twitter Card support
This commit is contained in:
Pat Hawks 2016-03-07 07:51:56 -08:00
commit 1fb75e9224
2 changed files with 18 additions and 1 deletions

View File

@ -132,7 +132,12 @@
{% endif %}
{% if site.twitter %}
<meta name="twitter:card" content="summary" />
{% if seo_page_image %}
<meta name="twitter:card" content="summary_large_image" />
{% else %}
<meta name="twitter:card" content="summary" />
{% endif %}
<meta name="twitter:site" content="@{{ site.twitter.username | replace:"@","" }}" />
{% if seo_author_twitter %}

View File

@ -203,6 +203,9 @@ EOS
let(:page) { make_page('author' => 'benbalter') }
it 'outputs twitter card meta' do
expected = %r{<meta name="twitter:card" content="summary" />}
expect(output).to match(expected)
expected = %r{<meta name="twitter:site" content="@jekyllrb" />}
expect(output).to match(expected)
@ -241,6 +244,15 @@ EOS
end
end
context 'with page.image' do
let(:page) { make_page('image' => '/img/foo.png') }
it 'outputs summary card with large image' do
expected = %r{<meta name="twitter:card" content="summary_large_image" />}
expect(output).to match(expected)
end
end
context 'with page.author as a hash' do
let(:page) { make_page('author' => { 'twitter' => '@test' }) }