Identify backlinks after fully completing the Roam/wiki link syntax conversion

This commit is contained in:
Maxime Vaillancourt 2020-07-21 17:57:36 -04:00
parent 2436845ca4
commit d8b794908f

View File

@ -6,6 +6,8 @@ class BidirectionalLinksGenerator < Jekyll::Generator
all_docs = all_notes + all_pages all_docs = all_notes + all_pages
# Convert all Wiki/Roam-style double-bracket link syntax to plain HTML
# anchor tag elements (<a>) with "internal-link" CSS class
all_docs.each do |current_note| all_docs.each do |current_note|
all_docs.each do |note_potentially_linked_to| all_docs.each do |note_potentially_linked_to|
current_note.content = current_note.content.gsub( current_note.content = current_note.content.gsub(
@ -13,7 +15,10 @@ class BidirectionalLinksGenerator < Jekyll::Generator
"<a class='internal-link' href='#{note_potentially_linked_to.url}'>#{note_potentially_linked_to.data['title']}</a>" "<a class='internal-link' href='#{note_potentially_linked_to.url}'>#{note_potentially_linked_to.data['title']}</a>"
) )
end 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| notes_linking_to_current_note = all_notes.filter do |e|
e.content.include?(current_note.url) e.content.include?(current_note.url)
end end