Fixed path handling for hack files

This commit is contained in:
Dan Brown 2025-05-17 23:08:31 +01:00
commit 2f94d3bcdf
Signed by: danb
GPG key ID: 46D9F943C24A2EF9

View 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"}}