From bd04997feedc9e031a0a99c3478b9f3bd557e8e7 Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Mon, 14 Sep 2020 19:07:56 +0530 Subject: [PATCH] Stash documents `write?` attribute in a variable (#8389) Merge pull request 8389 --- lib/jekyll/document.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/jekyll/document.rb b/lib/jekyll/document.rb index 11888f49..64c8b652 100644 --- a/lib/jekyll/document.rb +++ b/lib/jekyll/document.rb @@ -352,7 +352,9 @@ module Jekyll # method returns true, and if the site's Publisher will publish the document. # False otherwise. def write? - collection&.write? && site.publisher.publish?(self) + return @write_p if defined?(@write_p) + + @write_p = collection&.write? && site.publisher.publish?(self) end # The Document excerpt_separator, from the YAML Front-Matter or site