Attachments
This shortcode be deprecated 'n favor o' th' new resources
shortcode. See migrat'n instruct'ns below.
Th' examples on this plank were removed.
Th' attachments
shortcode displays a list o' files attached t' a plank wit' adjust'ble color, title an' ay'con.
Migrat'n
While this shortcode will still be avail'ble fer some time, it does not receive support anymore. Start t' migrate early, as it will be removed wit' th' next major update o' th' theme.
Th' resources
shortcode leverages Hugo’s resource feature fer plank bundles. It has all th' same parameter as th' attachments
shortcode but applies th' pattern
directly on a resources Name
attribute.
T' migrate yer planks apply th' follow'n steps:
- If a plank be not already a plank bundle convert it
- Move yer files t' a valid destinat'n inside o' yer plank bundle (depend'n if ye have a branch or a leaf bundle)
- Change th' calls from th'
attachments
shortcode t' th'resources
shortcode an' adjust th'pattern
parameter t' th' new directory layout an' th' resourcesName
attribute.
Multilanguage features be not supported directly by th' shortcode anymore but rely on Hugo’s handl'n fer resource translat'ns.
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: caut'n , important , info , note , tip , warning - by brand color: primary , secondary , accent - by color: blue , cyan , green , grey , magenta , orange , red - by special color: default , transparent , code Ye can also define yer own styles. |
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 directory. Th' name o' th' directory 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
directory, 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
directory, 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 directory 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 directories as languages an' th' language code must be part o' th' directory 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