Update twitter:image to output full url

This commit is contained in:
Bo Turnbow 2016-02-23 11:54:52 -07:00
parent 507c498267
commit 738f4efea7
2 changed files with 11 additions and 1 deletions

View File

@ -118,7 +118,7 @@
<meta name="twitter:description" content="{{ seo_description }}" />
{% if page.image %}
<meta name="twitter:image" content="{{ page.image | escape }}" />
<meta name="twitter:image" content="{{ page.image | prepend: "/" | prepend: seo_url | escape }}" />
{% endif %}
{% if seo_author_twitter %}

View File

@ -247,6 +247,16 @@ describe Jekyll::SeoTag do
expect(output).to match(expected)
end
end
context 'with page.image' do
let(:site) { make_site('twitter' => site_twitter, 'url' => 'http://example.invalid') }
let(:page) { make_page('image' => 'foo.png') }
it 'outputs the image' do
expected = %r{<meta name="twitter:image" content="http://example.invalid/foo.png" />}
expect(output).to match(expected)
end
end
end
end