add support for authors an an array

This commit is contained in:
Ben Balter 2016-02-21 13:52:49 -05:00
parent 902126fd4b
commit f1cdf62b53
2 changed files with 10 additions and 1 deletions

View File

@ -39,7 +39,7 @@
{% assign seo_description = seo_description | markdownify | strip_html | strip_newlines | escape_once %}
{% endif %}
{% assign seo_author = page.author | default: site.author %}
{% assign seo_author = page.author | default: page.authors[0] | default: site.author %}
{% if seo_author %}
{% if seo_author.twitter %}
{% assign seo_author_twitter = seo_author.twitter %}

View File

@ -227,6 +227,15 @@ describe Jekyll::SeoTag do
end
end
context 'with page.authors as an array' do
let(:page) { make_page('authors' => %w(test foo)) }
it 'supports author data as an array' do
expected = %r{<meta name="twitter:creator" content="@test" />}
expect(output).to match(expected)
end
end
context 'with site.author as a hash' do
let(:author) { { 'twitter' => '@test' } }
let(:site) { make_site('author' => author, 'twitter' => site_twitter) }