Attachments

Attachments
Arrr! ☠ Pirrrates ☠

Fello' pirrates, be awarrre some featurrres may not work fer us in this trrranslat'n. Like table of rrramblings, some Merrrmaids and stuff.

Th' Attachments shorrrtcode displays a list o' files attached t' a plank.

Usage

Th' shortcurt lists files found 'n a specific folder. Currently, it support two implementat'ns fer planks

  1. If yer plank be a Marrrkdown file, attachements must be placed 'n a folder named like yer plank an' end'n wit' .files.

    • rrrambl'n
      • _index.md
      • plank.files
        • attachment.pdf
      • plank.md
  2. If yer plank be a folder, attachements must be placed 'n a nested ‘files’ folder.

    • rrrambl'n
      • _index.md
      • plank
        • index.md
        • files
          • attachment.pdf

Be aware that if ye use a multilingual website, ye will need t' have as many folders as languages.

That’s all!

Parameters

Parameter Default Descript'n
title “Attachments” List’s title
ay'con “paperclip” Sets th' ay'con near th' title; if ye want no ay'con at all, ye have t' set this parameter t' " " (a non empty str'n filled wit' spaces)
sort “asc” Sort'n th' output 'n ascend'n or descend'n order
style "" Choose between orange, grey, blue an' green fer nice style
pattern “.*” A regular expressions, used t' filter th' attachments by file name.

Th' pattern parameter value must be regular expressions.

For example:

  • T' match a file suffix o' ‘jpg’, use *.jpg (not *.jpg).
  • T' match file names end'n 'n ‘jpg’ or ‘png’, use .*(jpg|png)

Examples

List o' attachments end'n 'n pdf or mp4

{{%attachments title="Related files" pattern=".*(pdf|mp4)"/%}}

renders as

Colored styled box

{{%attachments style="orange" /%}}

renders as

{{%attachments style="grey" /%}}

renders as

{{%attachments style="blue" /%}}

renders as

{{%attachments style="green" /%}}

renders as