Skip to content

Enhancement: Extend Media Configuration #395

@michaeltlombardi

Description

@michaeltlombardi

Is your feature request related to a problem? Please describe.

I was trying to turn my art shortcode into a snippet and thought it would be useful to be able to use the media snippet feature, especially since most of the fields for that shortcode are captured in the existing details for media files. In my case, I need two fields that aren't available for media files: extra classes to apply (which will always be context specific, not part of the details for the media file itself) and a content warning (which should always be used for that media and belongs in the media's details, if possible).

However, if I want to take advantage of the (extremely good!) functionality for media snippets, I can't define any extra fields for the snippet beyond the placeholders, as far as I can tell, and I would have to respecify the content warning every time I wanted to use the snippet, which could lead to drifting verbiage.

Describe the solution you'd like

I would like to be able to use media placeholders alongside custom inputs for media snippets and extend the details I can supply for media files in general.

If I could specify a snippet like this:

"Art": {
  "description": "Add art as a figure with an optional content warning.",
  "body": "{{< art src=\"[[&mediaUrl]]\" alt=\"[[&alt]]\" class=\"[[classes]]\" content_warning=\"[[&contentWarning]]\" />}}",
  "isMediaSnippet": true,
  "fields": [
    {
      "name": "classes",
      "title": "Class List: Specify any classes to add to the block in a space separated list.",
      "type": "string",
      "single": true,
      "default": ""
    }
  ]
}

And a setting in frontmatter.json (example name, probably not a good one) like this:

"frontMatter.media.extraDetailFields": [
  {
    "title": "Content Warning",
    "name": "contentWarning",
    "type": "string",
    "single": false
  }
]

Then when I select the Art media snippet, it would prompt me with a modal for the non-details fields (in this case, just classes) and otherwise work as the current ones do.

Describe alternatives you've considered

I could define a data set for my media which includes the content warning and always reference that (though snippets don't yet support this, I think). I could define a normal snippet and lose the media selection/automatic placeholders, which is still better than hand-authoring the shortcode, but not nearly as good as the UX for media snippets.

Additional context

N/A

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions