Merge pull request #44 from stefanlesser/fix-modified

Skip unnecessary rewrites of notes in `empty_front_matter_note_injector.rb`
This commit is contained in:
Maxime Vaillancourt 2021-01-16 14:39:08 -05:00 committed by GitHub
commit 73ba1d475a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,7 +10,9 @@ JEKYLL
Jekyll::Hooks.register :site, :after_init do |site| Jekyll::Hooks.register :site, :after_init do |site|
Dir.glob(site.collections['notes'].relative_directory + '/**/*.md').each do |filename| Dir.glob(site.collections['notes'].relative_directory + '/**/*.md').each do |filename|
raw_note_content = File.read(filename) raw_note_content = File.read(filename)
raw_note_content.prepend(EMPTY_FRONT_MATTER) unless raw_note_content.start_with?('---') unless raw_note_content.start_with?('---')
File.write(filename, raw_note_content) raw_note_content.prepend(EMPTY_FRONT_MATTER)
File.write(filename, raw_note_content)
end
end end
end end