The attachments shortcode displays a list of files attached to a page with adjustable color, title and icon.


While the examples are using shortcodes with named parameter you are free to also call this shortcode from your own partials.

{{% attachments sort="asc" /%}}
{{ partial "shortcodes/attachments.html" (dict
  "context" .
  "sort" "asc"

The shortcode lists files found in a specific folder.

Currently, it supports two implementations for pages

  1. If your page is a Markdown file, attachments must be placed in a folder named like your page and ending with .files.

    • content
      • page.files
        • attachment.pdf
  2. If your page is a folder, attachments must be placed in a nested files folder.

    • content
      • page
        • files
          • attachment.pdf

Be aware that if you use a multilingual website, you will need to have as many folders as languages.


Name Default Notes
style transparent The color scheme used to highlight the box content.

- 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 Arbitrary text for the box title. Depending on the style there may be a default title. Any given value will overwault.

- for severity styles: the matching title for the severity
- for all other colors: Attachments

If you wa 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 le** there may be a default icon. Any given value will overwrite the default.

- for severity styles: a nice matching iseverity
- for all other colors: paperclip

If you want no icon, you have to set this parameter to " " (a non empty d with spaces)
sort asc Sorting the output in ascending or descending order.
pattern .* A regular expressions, used to filter the attachments by file 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)


Custom Title, List of Attachments Ending in pdf or mp4

{{% attachments title="Related files" pattern=".*(pdf|mp4)" /%}}

Info Styled Box, Descending Sort Order

{{% attachments style="info" sort="desc" /%}}

Style and Icons

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