Merge pull request #203 from jekyll/nil-twitter-delete

Guard against the author's Twitter handle being Nil when stripping @'s
This commit is contained in:
Ben Balter 2017-05-02 13:48:58 -04:00 committed by GitHub
commit 7185353a6c
2 changed files with 10 additions and 1 deletions

View File

@ -88,7 +88,7 @@ module Jekyll
end
author["twitter"] ||= author["name"]
author["twitter"].delete! "@"
author["twitter"].delete! "@" if author["twitter"]
author.to_liquid
end
end

View File

@ -261,6 +261,15 @@ RSpec.describe Jekyll::SeoTag::Drop do
end
end
# See https://github.com/jekyll/jekyll-seo-tag/issues/202
context "without an author name or handle" do
let(:page_meta) { { "author" => { "foo" => "bar" } } }
it "dosen't blow up" do
expect(subject.author["twitter"]).to be_nil
end
end
context "with an explicit handle" do
let(:page_meta) do
{