Welcome to mirror list, hosted at ThFree Co, Russian Federation.

_index.md « attachments « shortcodes « content « exampleSite - github.com/vjeantet/hugo-theme-docport.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6d3449619f2b199c01952bfac94117e400ef6c4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
+++
title = "attachments"
description = "The Attachments shortcode displays a list of files attached to a page."
+++

The Attachments shortcode displays a list of files attached to a page.
Example :
{{%alert success%}}
{{%attachments  /%}}
{{%/alert%}}


## Usage

The shortcurt lists files found in the **_files folder**.

2. If your page is a **folderA**, attachements must be place in a **'_files'** subfolder.

```
content
└── folderA
       ├── _index.md
       └── _files
              ├── attachment.pdf
              └── attachment.pdf
```

That's all !

{{%alert info%}}**Tip** : Look at this documentation source code on github{{%/alert%}}

### parameters

| Parameter | Default | Description |
|:--|:--|:--|
| title | "Attachments" | List's title  |
| pattern | ".*" | A regular expressions, used to filter the attachments by file name. <br/><br/>{{%alert warning%}}The **pattern** parameter value must be [regular expressions](https://en.wikipedia.org/wiki/Regular_expression).

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)**

{{%/alert%}}|


## Demo
### List of attachments ending in pdf or mp4
```
    {{%/*attachments title="Related files" pattern=".*(pdf|mp4)"/*/%}}
```
renders as

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