Resources

The resources shortcode displays links to resources contained in a page bundle.

Attachments

Usage

{{% resources sort="asc" /%}}
{{ partial "shortcodes/resources.html" (dict
  "page" .
  "sort" "asc"
)}}

Multilanguage features are not supported directly by the shortcode but rely on Hugo’s handling for resource translations applied when the theme iterates over all available resources.

Parameter

Name Default Notes
style transparent The style scheme used for the box.

- by severity: caution, 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

You can also define your own styles.
color see notes The CSS color value to be used. If not set, the chosen color depends on the style. Any given value will overwrite the default.

- for severity styles: a nice matching color for the severity
- for all other styles: the corresponding color
title see notes Arbitrary text for the box title. Depending on the style there may be a default title. Any given value will overwrite the default.

- for severity styles: the matching title for the severity
- for all other styles: Resources

If you want no title for a severity style, you have to set this parameter to " " (a non empty string filled with spaces)
icon see notes Font Awesome icon name set to the left of the title. Depending on the style there may be a default icon. Any given value will overwrite the default.

- for severity styles: a nice matching icon for the severity
- for all other styles: paperclip

If you want no icon, you have to set this parameter to " " (a non empty string filled with spaces)
expanded <empty> Whether to draw an expander and how the resource list is displayed.

- <empty>: no expander is drawn and the resource list is permanently shown
- true: the expander is drawn and the resource list is initially shown
- false: the expander is drawn and the resource list is initially hidden
sort asc Sorting the output in ascending or descending order.
pattern .* A regular expressions, used to filter the resources by name. For example:

- to match a file suffix of ‘jpg’, use .*\.jpg (not *.\.jpg)
- to match file names ending in jpg or png, use .*\.(jpg|png)

Examples

Custom Title, List of Resources Ending in png, jpg or gif

{{% resources title="Related **files**" pattern=".*\.(png|jpg|gif)" /%}}
Related files

Info Styled Box, Descending Sort Order

{{% resources style="info" sort="desc" /%}}
Info

With User-Defined Color and Font Awesome Brand Icon

{{% resources color="fuchsia" icon="fa-fw fab fa-hackerrank" /%}}
Attachments

Expander with Initially Hidden Resource List

{{% resources style="primary" expanded="false" /%}}

Style, Color, Title and Icons

For further examples for style, color, title and icon, see the notice shortcode documentation. The parameter are working the same way for both shortcodes, besides having different defaults.