Memoize #author_hash in SeoTag::AuthorDrop (#342)

Merge pull request 342
This commit is contained in:
Ashwin Maroli 2019-11-29 19:36:03 +05:30 committed by jekyllbot
parent 3b99176f14
commit 895ab6c45b
1 changed files with 8 additions and 6 deletions

View File

@ -74,12 +74,14 @@ module Jekyll
# including site-wide metadata if the author is provided as a string,
# or an empty hash, if the author cannot be resolved
def author_hash
if resolved_author.is_a? Hash
resolved_author
elsif resolved_author.is_a? String
{ "name" => resolved_author }.merge(site_data_hash)
else
{}
@author_hash ||= begin
if resolved_author.is_a? Hash
resolved_author
elsif resolved_author.is_a? String
{ "name" => resolved_author }.merge(site_data_hash)
else
{}
end
end
end