bidirectional links

This commit is contained in:
Garry Ing
2021-03-10 22:33:55 -05:00
parent 22795467af
commit 1b95e9a8df
19 changed files with 643 additions and 7 deletions

View File

@ -0,0 +1,18 @@
# frozen_string_literal: true
EMPTY_FRONT_MATTER = <<~JEKYLL
---
---
JEKYLL
# Inject empty front matter in notes that don't have any
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)
unless raw_note_content.start_with?('---')
raw_note_content.prepend(EMPTY_FRONT_MATTER)
File.write(filename, raw_note_content)
end
end
end