Attachments
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' shortcurt lists files found 'n a specific folder.
Currently, it supports two implementat'ns fer planks
-
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
- rrrambl'n
-
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
- rrrambl'n
Be aware that if ye use a multilingual website, ye will need t' have as many folders as languages.
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 | Arbitray 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 asc end'n or desc end'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.