<commit_before>+++
title = "attachments"
description = "The Attachments shortcode displays a list of files attached to a page."

[menu.main]
parent = "shortcodes"
identifier = "attachments"
+++

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

The shortcurt lists files found in a **folder** named like your page and ending with **.files**.

When your page is named "mypage.md", create a folder named mypage**.files** and place your files in it. 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. |



{{%panel theme="warning" header="**Note about pattern** and regular expression"%}}
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)`

{{%/panel%}}


## Demo
### List of attachments ending in pdf or mp4

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

renders as

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

<commit_msg>attachments : fix example typo<commit_after>+++
title = "attachments"
description = "The Attachments shortcode displays a list of files attached to a page."

[menu.main]
parent = "shortcodes"
identifier = "attachments"
+++

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

The shortcurt lists files found in a **folder** named like your page and ending with **.files**.

When your page is named "mypage.md", create a folder named mypage**.files** and place your files in it. 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. |



{{%panel theme="warning" header="**Note about pattern** and regular expression"%}}
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)`

{{%/panel%}}


## 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)"/%}}


{'fraction_non_alphanumeric': 0.16642958748221906, 'fraction_numerical': 0.0021337126600284497, 'mean_word_length': 4.462135922330097, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5541290', 'n_tokens_mistral': 896, 'n_tokens_neox': 850, 'n_words': 328}