Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Allow for file or media field type #308

Closed
landure opened this issue Apr 3, 2022 · 2 comments
Closed

Enhancement: Allow for file or media field type #308

landure opened this issue Apr 3, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@landure
Copy link

landure commented Apr 3, 2022

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" ],
				},
@estruyf estruyf added the enhancement New feature or request label Apr 4, 2022
@estruyf
Copy link
Owner

estruyf commented Apr 4, 2022

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

@estruyf
Copy link
Owner

estruyf commented Apr 20, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants