From d22fcbef3553a255cb2e1ef49b8d889e46ddcc33 Mon Sep 17 00:00:00 2001 From: Alan M <17537489+Am3ra@users.noreply.github.com> Date: Sun, 31 Jan 2021 01:38:24 -0600 Subject: [PATCH 1/4] Update generator to include baseurl. One of the breaking errors that I fixed in my install of this great repo was that all links generated by the ruby script didn't take into account the baseurl specified in the config file. This ruby file corrects the error, although in the paths it might add one '/' too many. This hasn't caused me any issues, but should be considered. --- _plugins/bidirectional_links_generator.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/_plugins/bidirectional_links_generator.rb b/_plugins/bidirectional_links_generator.rb index 1efa1eb..90fe62a 100644 --- a/_plugins/bidirectional_links_generator.rb +++ b/_plugins/bidirectional_links_generator.rb @@ -24,28 +24,28 @@ class BidirectionalLinksGenerator < Jekyll::Generator # [[A note about cats|this is a link to the note about cats]] current_note.content = current_note.content.gsub( /\[\[#{title_from_filename}\|(.+?)(?=\])\]\]/i, - "\\1" + "\\1" ) # Replace double-bracketed links with label using note filename # [[cats|this is a link to the note about cats]] current_note.content = current_note.content.gsub( /\[\[#{note_potentially_linked_to.data['title']}\|(.+?)(?=\])\]\]/i, - "\\1" + "\\1" ) # Replace double-bracketed links using note title # [[a note about cats]] current_note.content = current_note.content.gsub( /\[\[(#{note_potentially_linked_to.data['title']})\]\]/i, - "\\1" + "\\1" ) # Replace double-bracketed links using note filename # [[cats]] current_note.content = current_note.content.gsub( /\[\[(#{title_from_filename})\]\]/i, - "\\1" + "\\1" ) end @@ -73,7 +73,7 @@ class BidirectionalLinksGenerator < Jekyll::Generator # Nodes: Graph graph_nodes << { id: note_id_from_note(current_note), - path: "#{current_note.url}#{link_extension}", + path: "#{site.baseurl}#{current_note.url}#{link_extension}", label: current_note.data['title'], } unless current_note.path.include?('_notes/index.html') From b84c65fda8ea0cc8db3aba6f0a6446d4bb17cb55 Mon Sep 17 00:00:00 2001 From: am3ra Date: Fri, 5 Feb 2021 01:23:41 -0600 Subject: [PATCH 2/4] add baseurl to more internal links in layouts --- _includes/head.html | 2 +- _includes/nav.html | 2 +- _layouts/note.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/_includes/head.html b/_includes/head.html index b287efa..721ce71 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -11,7 +11,7 @@ - + {% if page.excerpt %} diff --git a/_includes/nav.html b/_includes/nav.html index 5ed31df..ba4dc70 100644 --- a/_includes/nav.html +++ b/_includes/nav.html @@ -1,3 +1,3 @@
- {{ site.title }} + {{ site.title }}
diff --git a/_layouts/note.html b/_layouts/note.html index 0edb519..6c68ee4 100644 --- a/_layouts/note.html +++ b/_layouts/note.html @@ -22,7 +22,7 @@ layout: default
{% for backlink in page.backlinks %} {% endfor %} From 09ba4def4f60251d50eb3b7567d20801a6a93217 Mon Sep 17 00:00:00 2001 From: am3ra Date: Fri, 5 Feb 2021 01:31:34 -0600 Subject: [PATCH 3/4] fix baseurl to correct value --- _config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_config.yml b/_config.yml index d8dbcc5..f5e4501 100644 --- a/_config.yml +++ b/_config.yml @@ -4,7 +4,7 @@ exclude: ['_includes/notes_graph.json'] # You may need to change the base URL depending on your deploy configuration. # Specifically, when using GitHub Pages, the baseurl should point to where GitHub # Pages deploys your repository (which is usually the repository name). -baseurl: / +baseurl: # If you are using a host that cannot resolve URLs that do # not end with .html (such as Neocities), set this to 'true'. From 9cf05a68e06c39bd91b6c095159341ee4c99f784 Mon Sep 17 00:00:00 2001 From: Alan M <17537489+Am3ra@users.noreply.github.com> Date: Mon, 8 Feb 2021 15:32:45 -0600 Subject: [PATCH 4/4] Apply suggestions from code review Add spaces around `site.baseurl`, and add empty string to config Co-authored-by: Maxime Vaillancourt --- _config.yml | 2 +- _includes/nav.html | 2 +- _layouts/note.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/_config.yml b/_config.yml index f5e4501..7fb0e56 100644 --- a/_config.yml +++ b/_config.yml @@ -4,7 +4,7 @@ exclude: ['_includes/notes_graph.json'] # You may need to change the base URL depending on your deploy configuration. # Specifically, when using GitHub Pages, the baseurl should point to where GitHub # Pages deploys your repository (which is usually the repository name). -baseurl: +baseurl: '' # If you are using a host that cannot resolve URLs that do # not end with .html (such as Neocities), set this to 'true'. diff --git a/_includes/nav.html b/_includes/nav.html index ba4dc70..4f638f9 100644 --- a/_includes/nav.html +++ b/_includes/nav.html @@ -1,3 +1,3 @@
- {{ site.title }} + {{ site.title }}
diff --git a/_layouts/note.html b/_layouts/note.html index 6c68ee4..f77b95a 100644 --- a/_layouts/note.html +++ b/_layouts/note.html @@ -22,7 +22,7 @@ layout: default
{% for backlink in page.backlinks %} {% endfor %}