attachments

The Attachments shortcode displays a list of files attached to a page. Example :

Usage

The shortcurt lists files found in a specific folder. Currently, it support two implementations for pages

  1. If your page is a markdown file, attachements must be place in a folder named like your page and ending with .files.

    • content
      • _index.md
      • page.files
        • attachment.pdf
      • page.md
  2. If your page is a folder, attachements must be place in a nested ‘files’ folder.

    • content
      • _index.md
      • page
        • index.md
        • files
          • attachment.pdf

That’s all !

parameters

Parameter Default Description
title “Attachments” List’s title
pattern ”.*” A regular expressions, used to filter the attachments by file name.

Demo

List of attachments ending in pdf or mp4

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

renders as

  • Carroll_AliceAuPaysDesMerveilles.pdf (175 kB)
  • adivorciarsetoca00cape.pdf (361 kB)
  • movieselectricsheep-flock-244-32500-2.mp4 (340 kB)
  • Creative Commons LicenseThis work by Peter Baumgartner is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
    Permissions beyond the scope of this license may be available at http://peter.baumgartner.name/kontakt.
    Powered by the docdock theme for Hugo.