From 55d64c7e703c695a32ff5690d1c0dc58b7efe9e7 Mon Sep 17 00:00:00 2001 From: ashmaroli Date: Wed, 14 Mar 2018 16:21:45 +0530 Subject: [PATCH] Memoize `Site#site_data` (#6809) Merge pull request 6809 --- lib/jekyll/site.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 7281dccb..bda7e296 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -93,6 +93,7 @@ module Jekyll self.pages = [] self.static_files = [] self.data = {} + @site_data = nil @collections = nil @docs_to_write = nil @regenerator.clear_cache @@ -254,7 +255,7 @@ module Jekyll # # Returns the Hash to be hooked to site.data. def site_data - config["data"] || data + @site_data ||= (config["data"] || data) end # The Hash payload containing site-wide data.