Enhancement: Allow for file or media field type #244

Closed
opened 2026-10-05 02:35:39 +02:00 by adam · 2 comments
Owner

I'm using Hugo as a content generator. Hugo allow for audio and videos front matter fields for populating the corresponding opengraph values (see Configure Open Graph).

According to Hugo documentation:

audio and videos are URL arrays like images for the audio and video metadata tags, respectively.

The audio and videos fields definition should be:

				// an array of paths to audio files related to the page;
				// used by the opengraph internal template to populate og:audio.
				{
					"title": "Audio",
					"name": "audio",
					"type": "file",
					"multiple": true
				},
				// an array of paths to videos files related to the page;
				// used by the opengraph internal template to populate og:video.
				{
					"title": "Videos",
					"name": "v					ideos",
					"type": "file",
					"multiple": true
				}

with the file type working like the image type for any file type.

Additionally, a mime type or file extension filter for selected files should be possible:

				{
					"title": "Audio",
					"name": "audio",
					"type": "file",
					"multiple": true,
					allowed-mime-type: [ "audio/*", "audio/mp3" ],
					allowed-extensions: [ "mp3", "m4a", "wav", "flac" ],
				},
I'm using Hugo as a content generator. Hugo allow for `audio` and `videos` front matter fields for populating the corresponding opengraph values (see [Configure Open Graph](https://gohugo.io/templates/internal#configure-open-graph)). According to Hugo documentation: > audio and videos are URL arrays like images for the audio and video metadata tags, respectively. The `audio` and `videos` fields definition should be: ``` // an array of paths to audio files related to the page; // used by the opengraph internal template to populate og:audio. { "title": "Audio", "name": "audio", "type": "file", "multiple": true }, // an array of paths to videos files related to the page; // used by the opengraph internal template to populate og:video. { "title": "Videos", "name": "v ideos", "type": "file", "multiple": true } ``` with the file type working like the image type for any file type. Additionally, a mime type or file extension filter for selected files should be possible: ``` { "title": "Audio", "name": "audio", "type": "file", "multiple": true, allowed-mime-type: [ "audio/*", "audio/mp3" ], allowed-extensions: [ "mp3", "m4a", "wav", "flac" ], }, ``` <!-- github-sync-id:1190907644 -->
adam closed this issue 2026-10-05 02:35:39 +02:00
Author
Owner

Thank you @landure for the suggestion! It would definitely make sense to get this enhancement.

Thank you @landure for the suggestion! It would definitely make sense to get this enhancement. <!-- github-comment-id:1087475039 -->
Author
Owner

The first implementation of the new File field is completed.

Sample field configuration:

{
  "title": "Attachments",
  "name": "attachments",
  "type": "file",
  "multiple": true,
  "fileExtensions": ["pdf", "mp4", "wav"]
}

Empty field

Screenshot 2022-04-20 at 10 37 04

Single value

Screenshot 2022-04-20 at 10 36 58

Multiple files - single selection

Screenshot 2022-04-20 at 10 43 18

Multiple files

Screenshot 2022-04-20 at 10 43 31

The new field type will be available for testing in the latest beta version.

The first implementation of the new `File` field is completed. Sample field configuration: ```json { "title": "Attachments", "name": "attachments", "type": "file", "multiple": true, "fileExtensions": ["pdf", "mp4", "wav"] } ``` **Empty field** ![Screenshot 2022-04-20 at 10 37 04](https://user-images.githubusercontent.com/2900833/164195928-3358e9d4-401f-4ddf-b914-72c6076197d7.png) **Single value** ![Screenshot 2022-04-20 at 10 36 58](https://user-images.githubusercontent.com/2900833/164195929-209c56c3-12f3-4718-af76-772df2278c48.png) **Multiple files - single selection** ![Screenshot 2022-04-20 at 10 43 18](https://user-images.githubusercontent.com/2900833/164195925-1c6469ec-9838-4723-96a5-679447eeeb54.png) **Multiple files** ![Screenshot 2022-04-20 at 10 43 31](https://user-images.githubusercontent.com/2900833/164195919-f3496316-e54e-4569-88f3-9638bda49a27.png) The new field type will be available for testing in the latest beta version. <!-- github-comment-id:1103686746 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/vscode-front-matter#244