Skip to content
Open
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion layouts/_partials/components/codeblock.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@

{{- $base_url = strings.TrimSuffix "/" $base_url -}}
{{- $filename = strings.TrimPrefix "/" $filename -}}
{{- $file_url := urls.JoinPath $base_url $filename -}}

{{- $file_url := $filename -}} <!-- default to just filename -->

{{- if .full_url -}}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

full_url is ignored when $base_url is empty, please pay attention to line 9

{{- $file_url = .full_url -}}
{{- else if $base_url -}}
{{- $file_url = urls.JoinPath $base_url $filename -}}
{{- end -}}


<a class="hx:no-underline hx:inline-flex hx:items-center hx:gap-1" href="{{ $file_url }}" target="_blank" rel="noopener noreferrer">
<span>{{- $filename -}}</span>
Expand Down