diff --git a/exampleSite/content/shortcodes/attachments.pir.files/NoTreasure.txt b/exampleSite/content/shortcodes/attachments.pir.files/NoTreasure.txt new file mode 100644 index 0000000000..f7b9fda214 --- /dev/null +++ b/exampleSite/content/shortcodes/attachments.pir.files/NoTreasure.txt @@ -0,0 +1 @@ +Harrr, nothn' to see herre \ No newline at end of file diff --git a/exampleSite/content/shortcodes/attachments.pir.md b/exampleSite/content/shortcodes/attachments.pir.md index e9e50df62c..da31540ccc 100644 --- a/exampleSite/content/shortcodes/attachments.pir.md +++ b/exampleSite/content/shortcodes/attachments.pir.md @@ -2,4 +2,6 @@ descrption = "Th' Attachments shorrrtcode displays a list o' files attached t' a plank" title = "Attachments" +++ -{{< piratify >}} \ No newline at end of file +{{% attachments /%}} + +{{< piratify >}} diff --git a/layouts/shortcodes/attachments.html b/layouts/shortcodes/attachments.html index d348f395cc..0c17506257 100644 --- a/layouts/shortcodes/attachments.html +++ b/layouts/shortcodes/attachments.html @@ -10,9 +10,12 @@ {{- $filesName = printf "%s.files" .Page.File.BaseFileName }} {{- end}} - {{- $fileDir := replace .Page.File.Dir "\\" "/" }} + {{- $fileLink := printf "%s/%s" (.Page.Language.ContentDir | default "content") .Page.File.Dir }} + {{- $fileLink = replace (replace $fileLink "\\" "/") "content/" "" }} + {{- $fileDir := printf "%s/%s" (.Page.Language.ContentDir | default "content") .Page.File.Dir }} + {{- $fileDir = replace $fileDir "\\" "/" }} {{- $pattern := .Get "pattern" | default "" }} - {{- range sort (readDir (printf "content/%s%s" .Page.File.Dir $filesName) ) "Name" $sort }} + {{- range sort (readDir (printf "%s%s" $fileDir $filesName) ) "Name" $sort }} {{- if findRE $pattern .Name}} {{- $size := .Size }} {{- $unit := "Byte-symbol" }} @@ -25,7 +28,7 @@ {{- $unit = "Megabyte-symbol" }} {{- end }} {{- $unitsymbol := $unit | T }} -
  • {{.Name}} ({{$size}} {{$unitsymbol}})
  • +
  • {{.Name}} ({{$size}} {{$unitsymbol}})
  • {{- end }} {{- end }}