From 9c6b55cfffa646cbe5a8c0a72bd1fd6a6a4150e0 Mon Sep 17 00:00:00 2001 From: Stefan Lesser Date: Sat, 16 Jan 2021 18:23:08 +0000 Subject: [PATCH] Fixed issue with plugin that touched all original notes and updated their modified date unnecessarily. --- _plugins/empty_front_matter_note_injector.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/_plugins/empty_front_matter_note_injector.rb b/_plugins/empty_front_matter_note_injector.rb index c4979c9..83fd4b2 100644 --- a/_plugins/empty_front_matter_note_injector.rb +++ b/_plugins/empty_front_matter_note_injector.rb @@ -10,7 +10,9 @@ JEKYLL Jekyll::Hooks.register :site, :after_init do |site| Dir.glob(site.collections['notes'].relative_directory + '/**/*.md').each do |filename| raw_note_content = File.read(filename) - raw_note_content.prepend(EMPTY_FRONT_MATTER) unless raw_note_content.start_with?('---') - File.write(filename, raw_note_content) + unless raw_note_content.start_with?('---') + raw_note_content.prepend(EMPTY_FRONT_MATTER) + File.write(filename, raw_note_content) + end end end