Skip to content

Commit 198ebba

Browse files
committed
Fix relative paths
1 parent 49bf237 commit 198ebba

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

script/update-docs.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,23 +124,23 @@ def extract_glossary_from_html(content, lang = 'en')
124124
current_element = dt.next_element
125125
raise 'Expected dd' unless current_element&.name == 'dd'
126126

127-
# Fix up the links because they'regoing to be on a different page
127+
# Fix up the links because they're going to be on a different page
128128
if lang == 'en'
129-
glossary_url = '/docs/gitglossary'
129+
glossary_path = 'docs/gitglossary'
130130
else
131-
glossary_url = "/docs/gitglossary/#{lang}"
131+
glossary_path = "docs/gitglossary/#{lang}"
132132
end
133133

134134
definition_fragment = Nokogiri::HTML::DocumentFragment.parse(current_element.inner_html.strip)
135135
definition_fragment.css('a[href^="#def_"]').each do |link|
136136
href = link['href']
137137
if href&.start_with?('#def_')
138-
link['href'] = "#{glossary_url}#{href}"
138+
link['href'] = "{{< relurl \"#{glossary_path}#{href}\" >}}"
139139
link['target'] = '_blank'
140140
end
141141
end
142142
definition = definition_fragment.to_html
143-
143+
144144
term_names.each do |term|
145145
glossary[term] = definition
146146
end

static/js/glossary.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ var GitGlossary = {
5656
const truncatedDefinition = this.truncateWords(definition, 60);
5757

5858
const language = document.querySelector("html")?.getAttribute("lang") || 'en';
59-
const glossaryUrl = language === 'en' ? '/docs/gitglossary' : `/docs/gitglossary/${language}`;
59+
const glossaryUrl = language === 'en' ? baseURLPrefix + 'docs/gitglossary' : baseURLPrefix + `docs/gitglossary/${language}`;
6060

6161
this.tooltip.querySelector('.tooltip-content').innerHTML = `
6262
<a href="${glossaryUrl}#def_${term}" target="_blank">

0 commit comments

Comments
 (0)