Attachments
Th' attachments
shortcode displays a list o' files attached t' a plank wit' adjust'ble color, title an' ay'con.
Since Cap'n Hugo 0.112.0 this only works fer leaf bundles. Branch bundles an' simple planks must be switched t' leaf bundles or ye be currently locked t' a Cap'n Hugo version < 0.112.0
.
Usage
While th' examples be us'n shorrrtcodes wit' named parameter ye be free t' also call this shortcode from yer own partials.
{{% attachments sort="asc" /%}}
{{ partial "shortcodes/attachments.html" (dict
"page" .
"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 , accent - by color: blue , green , grey , orange , red - by special color: default , transparent , code |
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' shortcode lists files found 'n a specific folder. Th' name o' th' folder depends on yer plank type (either branch bundle, leaf bundle or page).
-
If yer plank be a leaf bundle, attachments must be placed 'n a nested
index.files
folder, accordingly.- rrrambl'n
- _index.md
- plank
- _index.md
- _index.files
- attachment.pdf
- rrrambl'n
-
If yer plank be a branch bundle, attachments must be placed 'n a nested
_index.files
folder, accordingly.Arrr This be only avail'ble fer Cap'n Hugo <
0.112.0
- rrrambl'n
- _index.md
- plank
- index.md
- index.files
- attachment.pdf
- rrrambl'n
-
For simple planks, attachments must be placed 'n a folder named like yer plank an' end'n wit'
.files
.Arrr This be only avail'ble fer Cap'n Hugo <
0.112.0
- rrrambl'n
- _index.md
- plank.files
- attachment.pdf
- plank.md
- 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
- index.en.md
- index.pir.md
- index.en.files
- attachment.pdf
- index.pir.files
- attachment.pdf
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
shortcode documentat'n. Th' parameter be work'n th' same way fer both shorrrtcodes, besides hav'n different defaults.