From d8b794908ffb54f2b9be1d2fa96beda573b76380 Mon Sep 17 00:00:00 2001 From: Maxime Vaillancourt Date: Tue, 21 Jul 2020 17:57:36 -0400 Subject: [PATCH] Identify backlinks after fully completing the Roam/wiki link syntax conversion --- _plugins/bidirectional_links_generator.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/_plugins/bidirectional_links_generator.rb b/_plugins/bidirectional_links_generator.rb index dfe2bac..f6a5a65 100644 --- a/_plugins/bidirectional_links_generator.rb +++ b/_plugins/bidirectional_links_generator.rb @@ -6,6 +6,8 @@ class BidirectionalLinksGenerator < Jekyll::Generator all_docs = all_notes + all_pages + # Convert all Wiki/Roam-style double-bracket link syntax to plain HTML + # anchor tag elements () with "internal-link" CSS class all_docs.each do |current_note| all_docs.each do |note_potentially_linked_to| current_note.content = current_note.content.gsub( @@ -13,7 +15,10 @@ class BidirectionalLinksGenerator < Jekyll::Generator "#{note_potentially_linked_to.data['title']}" ) end + end + # Identify note backlinks and add them to each note + all_notes.each do |current_note| notes_linking_to_current_note = all_notes.filter do |e| e.content.include?(current_note.url) end