Attachments

Attachments
Arrr! Pirrrates

Fello' pirrates, be awarrre some stuff may not work fer us in this trrranslat'n. Like table of rrramblings, see'ng Merrrmaids, do'ng math or chemistrrry and stuff.

Th' attachments shorrrtcode displays a list o' files attached t' a plank wit' adjust'ble color, title an' ay'con.

Usage

While th' examples be us'n shorrrtcodes wit' named parameter ye be free t' also call this shorrrtcode from yer own partials.

{{% attachments sort="asc" /%}}
{{ partial "shortcodes/attachments.html" (dict
  "context" .
  "sort" "asc"
)}}

Th' shorrrtcode lists files found 'n a specific folder. Th' name o' th' folder depends on yer plank type (either branch bundle, leaf bundle or page).

  1. For simple planks, attachments 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 branch or leaf bundle, attachments must be placed 'n a nested _index.files or ‘index.files’ folder, accordingly.

    For branch bundles:

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

    For leaf bundles:

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

Be aware that if ye use a multilingual website, ye will need t' have as many folders as languages an' th' language code must be part o' th' folder name.

Eg. fer a ship 'n English an' Piratish:

  • rrrambl'n
    • _index.en.md
    • _index.pir.md
    • plank.en.files
      • attachment.pdf
    • plank.pir.files
      • attachment.pdf
    • plank.en.md
    • plank.pir.md

Parameter

Name Default Notes
style transparent Th' color scheme used t' highlight th' box rrrambl'n.

- by severity: info, note, tip, warning<nd color: primary, secondary
- by color: blue, green, grey, orange, red
- by special color: default,t`
title see notes Arbitrary text fer th' box title. Depend'n on th' style there may be a default title. Any given value will overwault.

- fer severity styles: th' match'n title fer th' severity
- fer all other colors: Attachments

If ye wa ye have t' set this parameter t' " " (a non empty str'n filled wit' spaces)
ay'con see notes Font Awesome ay'con name set t' th' left o' th' title. Depend'n le** there may be a default ay'con. Any given value will overwrite th' default.

- fer severity styles: a nice match'n iseverity
- fer all other colors: paperclip

If ye want no ay'con, ye have t' set this parameter t' " " (a non empty d wit' spaces)
sort asc Sort'n th' output 'n ascend'n or descend'n order.
pattern .* A regular expressions, used t' filter th' attachments by file name. 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

Custom Title, List o' Attachments End'n 'n pdf or mp4

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

Ahoi Styled Box, Descend'n Sort Order

{{% attachments style="info" sort="desc" /%}}

Style an' Ay'cons

For further examples fer style, title an' ay'con, see th' notice shorrrtcode documentat'n. Th' parameter be work'n th' same way fer both shorrrtcodes, besides hav'n different defaults.