Skip to content

Commit ac70b2f

Browse files
Merge pull request #46 from Am3ra/patch-1
Update generator to include baseurl.
2 parents 9232ce3 + 9cf05a6 commit ac70b2f

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ exclude: ['_includes/notes_graph.json']
44
# You may need to change the base URL depending on your deploy configuration.
55
# Specifically, when using GitHub Pages, the baseurl should point to where GitHub
66
# Pages deploys your repository (which is usually the repository name).
7-
baseurl: /
7+
baseurl: ''
88

99
# If you are using a host that cannot resolve URLs that do
1010
# not end with .html (such as Neocities), set this to 'true'.

_includes/head.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgo=">
1313

14-
<link rel="stylesheet" href="{{ site.baseurl }}styles.css">
14+
<link rel="stylesheet" href="{{ site.baseurl }}/styles.css">
1515

1616
{% if page.excerpt %}
1717
<meta property="og:description" content="{{ page.excerpt | strip_html | strip_newlines | truncate: 160 }}"/>

_includes/nav.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<div>
2-
<a class="internal-link" href="/"><b>{{ site.title }}</b></a>
2+
<a class="internal-link" href="{{ site.baseurl }}/"><b>{{ site.title }}</b></a>
33
</div>

_layouts/note.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ <h3 style="margin-bottom: 1em">Notes mentioning this note</h3>
2222
<div style="display: grid; grid-gap: 1em; grid-template-columns: repeat(1fr);">
2323
{% for backlink in page.backlinks %}
2424
<div class="backlink-box">
25-
<a class="internal-link" href="{{ backlink.url }}{%- if site.use_html_extension -%}.html{%- endif -%}">{{ backlink.title }}</a><br>
25+
<a class="internal-link" href="{{ site.baseurl }}{{ backlink.url }}{%- if site.use_html_extension -%}.html{%- endif -%}">{{ backlink.title }}</a><br>
2626
<div style="font-size: 0.9em">{{ backlink.excerpt | strip_html | truncatewords: 20 }}</div>
2727
</div>
2828
{% endfor %}

_plugins/bidirectional_links_generator.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,28 @@ def generate(site)
2424
# [[A note about cats|this is a link to the note about cats]]
2525
current_note.content = current_note.content.gsub(
2626
/\[\[#{title_from_filename}\|(.+?)(?=\])\]\]/i,
27-
"<a class='internal-link' href='#{note_potentially_linked_to.url}#{link_extension}'>\\1</a>"
27+
"<a class='internal-link' href='#{site.baseurl}#{note_potentially_linked_to.url}#{link_extension}'>\\1</a>"
2828
)
2929

3030
# Replace double-bracketed links with label using note filename
3131
# [[cats|this is a link to the note about cats]]
3232
current_note.content = current_note.content.gsub(
3333
/\[\[#{note_potentially_linked_to.data['title']}\|(.+?)(?=\])\]\]/i,
34-
"<a class='internal-link' href='#{note_potentially_linked_to.url}#{link_extension}'>\\1</a>"
34+
"<a class='internal-link' href='#{site.baseurl}#{note_potentially_linked_to.url}#{link_extension}'>\\1</a>"
3535
)
3636

3737
# Replace double-bracketed links using note title
3838
# [[a note about cats]]
3939
current_note.content = current_note.content.gsub(
4040
/\[\[(#{note_potentially_linked_to.data['title']})\]\]/i,
41-
"<a class='internal-link' href='#{note_potentially_linked_to.url}#{link_extension}'>\\1</a>"
41+
"<a class='internal-link' href='#{site.baseurl}#{note_potentially_linked_to.url}#{link_extension}'>\\1</a>"
4242
)
4343

4444
# Replace double-bracketed links using note filename
4545
# [[cats]]
4646
current_note.content = current_note.content.gsub(
4747
/\[\[(#{title_from_filename})\]\]/i,
48-
"<a class='internal-link' href='#{note_potentially_linked_to.url}#{link_extension}'>\\1</a>"
48+
"<a class='internal-link' href='#{site.baseurl}#{note_potentially_linked_to.url}#{link_extension}'>\\1</a>"
4949
)
5050
end
5151

@@ -73,7 +73,7 @@ def generate(site)
7373
# Nodes: Graph
7474
graph_nodes << {
7575
id: note_id_from_note(current_note),
76-
path: "#{current_note.url}#{link_extension}",
76+
path: "#{site.baseurl}#{current_note.url}#{link_extension}",
7777
label: current_note.data['title'],
7878
} unless current_note.path.include?('_notes/index.html')
7979

0 commit comments

Comments
 (0)