]> BookStack Code Mirror - website/commitdiff
Fixed path handling for hack files
authorDan Brown <redacted>
Sat, 17 May 2025 22:08:31 +0000 (23:08 +0100)
committerDan Brown <redacted>
Sat, 17 May 2025 22:08:31 +0000 (23:08 +0100)
themes/bookstack/layouts/shortcodes/hack.html

index fcd64062cac56da3391856367f54393e9ac8a17f..e1f825dda5e0500c717f66be6c3a4ed248ab5e5d 100644 (file)
@@ -1,5 +1,5 @@
 {{ $filename := .Get "file" }}
-{{ $file := path.Join (path.Dir $.Page.File) $filename }}
+{{ $file := path.Join .Page.Path $filename }}
 {{ $ext := strings.TrimLeft "." (path.Ext $file) }}
 {{ if strings.HasSuffix $file ".blade.php" }}
     {{ $ext = "html" }}
@@ -8,7 +8,6 @@
 {{ $md := printf "```%s\n%s\n```" $ext (readFile $file) }}
 {{ $mdLen := len (split $md "\n") }}
 
-
 <div class="hack-file-wrapper">
 
     
@@ -17,8 +16,8 @@
             <div class="hack-file-block-filename">{{ $filename }}</div>
         
             <div class="hack-file-block-type type-{{ $type }}">
-                <a target="_blank" href="/{{ path.Join (path.Dir $.Page.File) $filename  }}">Download</a> |
-                <a target="_blank" href="/hacks/applying/#{{ if eq $type "logical"}}logical-theme-system{{ else if eq $type "visual"}}visual-theme-system{{ else if eq $type "head"}}head-html{{end}}" target="_blank">
+                <a target="_blank" href="{{ $file  }}">Download</a> |
+                <a target="_blank" href="/hacks/applying/#{{ if eq $type "logical"}}logical-theme-system{{ else if eq $type "visual"}}visual-theme-system{{ else if eq $type "head"}}head-html{{end}}">
                     {{ if eq $type "logical"}}
                     Logical Theme System
                     {{ else if eq $type "visual"}}