searchable-jekyll-template/_plugins/bidirectional_links_generator.rb
Maxime Vaillancourt a110142f56 Initial release
2020-05-19 22:59:37 -04:00

16 lines
384 B
Ruby

# frozen_string_literal: true
class BidirectionalLinksGenerator < Jekyll::Generator
def generate(site)
notes = site.collections['notes'].docs
notes.each do |current_note|
notes_linking_to_current_note = notes.filter do |e|
e.content.include?(current_note.url)
end
current_note.data['backlinks'] = notes_linking_to_current_note
end
end
end