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"
)}}
Parameter
Name | Default | Notes |
---|---|---|
style | transparent |
Th' style scheme used fer th' box. - by severity: info , note , tip , warning - by brand color: primary , secondary - by color: blue , green , grey , orange , red - by special color: default , transparent |
color | see notes | Th' CSS color value t' be used. If not set, th' chosen color depends on th' style. Any given value will overwrite th' default. - fer severity styles: a nice match'n color fer th' severity - fer all other styles: th' correspond'n color |
title | see notes | Arbitrary text fer th' box title. Depend'n on th' style there may be a default title. Any given value will overwrite th' default. - fer severity styles: th' match'n title fer th' severity - fer all other styles: Attachments If ye want no title fer a severity style, 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 on th' style there may be a default ay'con. Any given value will overwrite th' default. - fer severity styles: a nice match'n ay'con fer th' severity - fer all other styles: 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) |
Setup
Single language
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).
-
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
- rrrambl'n
-
If yer plank be a branch or leaf bundle, attachments must be placed 'n a nested
_index.files
orindex.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
- rrrambl'n
Multilingual
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
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" /%}}
Wit' User-Defined Color an' Font Awesome Brand Ay'con
{{% attachments color="fuchsia" ay'con="fab fa-hackerrank" /%}}
Style, Color, Title an' Ay'cons
For further examples fer style, color, 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.