Memoize `Site#site_data` (#6809)

Merge pull request 6809
This commit is contained in:
ashmaroli 2018-03-14 16:21:45 +05:30 committed by jekyllbot
parent 6a7a393df5
commit 55d64c7e70
1 changed files with 2 additions and 1 deletions

View File

@ -93,6 +93,7 @@ module Jekyll
self.pages = [] self.pages = []
self.static_files = [] self.static_files = []
self.data = {} self.data = {}
@site_data = nil
@collections = nil @collections = nil
@docs_to_write = nil @docs_to_write = nil
@regenerator.clear_cache @regenerator.clear_cache
@ -254,7 +255,7 @@ module Jekyll
# #
# Returns the Hash to be hooked to site.data. # Returns the Hash to be hooked to site.data.
def site_data def site_data
config["data"] || data @site_data ||= (config["data"] || data)
end end
# The Hash payload containing site-wide data. # The Hash payload containing site-wide data.