From 8538d1244581b39319b01e3c4eeeb2c18ef89ca3 Mon Sep 17 00:00:00 2001 From: Maxime Vaillancourt Date: Mon, 2 Nov 2020 22:54:30 +0000 Subject: [PATCH] Duplicate note title to prevent in-place modification Fixes https://github.com/maximevaillancourt/digital-garden-jekyll-template/issues/21 --- _plugins/bidirectional_links_generator.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/_plugins/bidirectional_links_generator.rb b/_plugins/bidirectional_links_generator.rb index 8d7b52c..70f956f 100644 --- a/_plugins/bidirectional_links_generator.rb +++ b/_plugins/bidirectional_links_generator.rb @@ -66,7 +66,11 @@ class BidirectionalLinksGenerator < Jekyll::Generator end def note_id_from_note(note) - note.data['title'].gsub!(/\W+/, ' ') - note.data['title'].delete(' ').to_i(36).to_s + note.data['title'] + .dup + .gsub(/\W+/, ' ') + .delete(' ') + .to_i(36) + .to_s end end