Skip to content

Commit 492d6df

Browse files
committed
Added media content type info
1 parent 7173233 commit 492d6df

File tree

11 files changed

+4964
-59
lines changed

11 files changed

+4964
-59
lines changed

.frontmatter/database/mediaDb.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

content/docs/dashboard/media-view.md

Lines changed: 64 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Media view
33
slug: media-view
44
description: null
55
date: 2022-11-28T14:55:04.221Z
6-
lastmod: 2023-04-01T13:53:45.580Z
6+
lastmod: 2024-02-22T11:23:12.499Z
77
weight: 300.2
88
---
99

@@ -13,7 +13,7 @@ The media view has been created to make it easier to look at all media files ava
1313
articles. When you click on an image, it will show a lightbox, so that it is easier to glance at
1414
small images.
1515

16-
![Dashboard - Media view - Lightbox][01]
16+
![Media dashboard][01]
1717

1818
## Supported files
1919

@@ -31,12 +31,69 @@ If you want that the media dashboard supports additional file types, you can def
3131
]
3232
```
3333

34+
## Metadata
35+
36+
The media dashboard supports metadata for images. By default, the following metadata is supported:
37+
38+
- Title
39+
- Caption
40+
- Alternate text
41+
42+
Since version `10.0.0`, you can define your own metadata fields by defining media content types.
43+
44+
### Media content types
45+
46+
Media content types are defined in the `frontMatter.media.contentTypes` setting. This setting allows
47+
you to define your own metadata fields for your media files.
48+
49+
#### Media content type properties
50+
51+
| Property | Type | Description | Default |
52+
| --- | --- | --- | --- |
53+
| `name` | `string` | The name of the content type. | `""` |
54+
| `fileTypes` | `string[]` | The file extensions that should be associated with this content type. | `[]` |
55+
| `fields` | `field[]` | The fields that should be shown for this content type. | `[]` |
56+
57+
#### Media field properties
58+
59+
| Property | Type | Description | Default |
60+
| --- | --- | --- | --- |
61+
| `title` | `string` | The title of the field. | `""` |
62+
| `name` | `string` | The name of the field. | `""` |
63+
| `type` | `string` | The type of the field (`string`). | `""` |
64+
| `single` | `boolean` | If the field is a single line value. | `true` |
65+
66+
```json {{ "title": "Example of defining media content types" }}
67+
{
68+
"frontMatter.media.contentTypes": [{
69+
"name": "default",
70+
"fileTypes": ["png", "jpg", "jpeg", "gif"],
71+
"fields": [{
72+
"title": "Title",
73+
"name": "title",
74+
"type": "string"
75+
},
76+
{
77+
"title": "Author",
78+
"name": "author",
79+
"type": "string"
80+
},
81+
{
82+
"title": "Alt text",
83+
"name": "alt",
84+
"type": "string"
85+
}
86+
]
87+
}]
88+
}
89+
```
90+
3491
## Media actions
3592

3693
On the image card, there are actions like setting metadata, copying the relative path, and deleting
3794
the media file.
3895

39-
### Setting metadata
96+
### Updating metadata
4097

4198
Setting metadata got introduced so that you can set the description and alt tag of your images. This
4299
functionality makes it easier to insert your images to your content.
@@ -77,9 +134,9 @@ your explorer/finder window into one of your folders.
77134
![Dashboard - Upload media file][06]
78135

79136
<!-- Link References -->
80-
[01]: /releases/v5.9.0/media-lightbox.png
81-
[02]: /releases/v5.0.0/metadata-media.png
137+
[01]: /releases/v10.0.0/media-dashboard.png
138+
[02]: /releases/v10.0.0/metadata-update.png
82139
[03]: /docs/markdown#insert-images
83-
[04]: /releases/v5.9.0/media-deletion.png
140+
[04]: /releases/v10.0.0/delete-media.png
84141
[05]: /docs/custom-actions#creating-a-media-script
85-
[06]: /releases/v5.9.0/media-upload.png
142+
[06]: /releases/v10.0.0/media-upload.png

content/docs/settings/available-settings.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Settings overview
33
slug: settings/overview
44
description: null
55
date: 2023-02-13T16:44:09.618Z
6-
lastmod: 2024-02-22T10:16:24.290Z
6+
lastmod: 2024-02-22T11:12:35.358Z
77
weight: 1100.2
88
---
99

@@ -455,6 +455,15 @@ Specifies which type of notifications you want to see or which you want to hide.
455455
- Type: `array<string>`
456456
- Default: `["info", "warning", "error"]`
457457

458+
### frontMatter.media.contentTypes
459+
460+
Specify the content types you want to use for your media files.
461+
462+
- Type: `array`
463+
- Default: ``
464+
465+
> **Info**: More information on how to use it can be found in the [media content types][24] section.
466+
458467
### frontMatter.media.defaultSorting
459468

460469
Specify the default sorting option for the media dashboard.
@@ -849,3 +858,4 @@ This setting has been deprecated since version `3.1.0` in favour of the newly in
849858
[21]: /docs/content-creation/multilingual
850859
[22]: /docs/content-view#sorting
851860
[23]: /docs/content-view#filters
861+
[24]: /docs/media-view#metadata

frontmatter.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,12 @@
239239
"script": "./scripts/convert-webp.mjs",
240240
"command": "~/.nvm/versions/node/v18.17.1/bin/node",
241241
"type": "mediaFile"
242+
},
243+
{
244+
"title": "Optimize",
245+
"script": "./scripts/optimize.mjs",
246+
"command": "~/.nvm/versions/node/v18.17.1/bin/node",
247+
"type": "mediaFile"
242248
}
243249
]
244250
}

0 commit comments

Comments
 (0)