updated plugin
This commit is contained in:
parent
df2f53784a
commit
b2c6c90262
@ -22,7 +22,7 @@ title: Digital Garden
|
||||
email: hello@hypha.coop
|
||||
description: >- # this means to ignore newlines until "baseurl:"
|
||||
A digital garden or public notebook for The Bentway’s Digital and/as Public Space Micro-Residency.
|
||||
baseurl: "/" # the subpath of your site, e.g. /blog
|
||||
baseurl: "" # the subpath of your site, e.g. /blog
|
||||
url: "" # the base hostname & protocol for your site, e.g. http://example.com
|
||||
|
||||
# Layout
|
||||
|
@ -20,32 +20,35 @@ class BidirectionalLinksGenerator < Jekyll::Generator
|
||||
File.extname(note_potentially_linked_to.basename)
|
||||
).gsub('_', ' ').gsub('-', ' ').capitalize
|
||||
|
||||
new_href = "#{site.baseurl}#{note_potentially_linked_to.url}#{link_extension}"
|
||||
anchor_tag = "<a class='internal-link' href='#{new_href}'>\\1</a>"
|
||||
|
||||
# Replace double-bracketed links with label using note title
|
||||
# [[A note about cats|this is a link to the note about cats]]
|
||||
current_note.content = current_note.content.gsub(
|
||||
/\[\[#{title_from_filename}\|(.+?)(?=\])\]\]/i,
|
||||
"<a class='internal-link' href='.#{note_potentially_linked_to.url}#{link_extension}'>\\1</a>"
|
||||
anchor_tag
|
||||
)
|
||||
|
||||
# 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,
|
||||
"<a class='internal-link' href='.#{note_potentially_linked_to.url}#{link_extension}'>\\1</a>"
|
||||
anchor_tag
|
||||
)
|
||||
|
||||
# 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,
|
||||
"<a class='internal-link' href='.#{note_potentially_linked_to.url}#{link_extension}'>\\1</a>"
|
||||
anchor_tag
|
||||
)
|
||||
|
||||
# Replace double-bracketed links using note filename
|
||||
# [[cats]]
|
||||
current_note.content = current_note.content.gsub(
|
||||
/\[\[(#{title_from_filename})\]\]/i,
|
||||
"<a class='internal-link' href='.#{note_potentially_linked_to.url}#{link_extension}'>\\1</a>"
|
||||
anchor_tag
|
||||
)
|
||||
end
|
||||
|
||||
@ -73,7 +76,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')
|
||||
|
||||
@ -103,4 +106,4 @@ class BidirectionalLinksGenerator < Jekyll::Generator
|
||||
.to_i(36)
|
||||
.to_s
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user