Link to Media Field Reference

This article explains what the Link to Media Field is and how to configure it.


The Link to Media Field reference allows you to upload files.

Links vs Link to Media

The Link Field and Link to Media Fields look similar. The Link Field should be used to create web links, like a CTA. The Link to Media Field should be used to host files.

JSON model

The following table displays the JSON keys and values of the field’s 'API response.

type 

string (required)

Value must be "Link"

config  

object

Object for the configuration options

config.label 

string

The label that shows up for the field in the entry editor

config.placeholder 

string

A user-friendly placeholder for the field in the entry editor

config.select 

string

Must be "media"

config.allowTargetBlank 

boolean

If set to true, will allow an author to select the Open in a new tab option

Example JSON configuration

The following JSON defines a link to anything (external URL, internal content, or Media Library file.)

Copy
"example_link_to_media" : {
  "type" : "Link",
  "config" : {
    "select" : "media",
    "label" : "Example Link to Media",
    "placeholder" : "mona-lisa.jpeg"
  }
},

API response example

Here is an API response example of a Link to Media field:

Copy
"example_link_to_media": {
  "link_type": "Media",
  "name": "mona-lisa",
  "kind": "image",
   "url": "https://images.prismic.io/example-prismic-repo/mona-lisa?auto=compress,format",
  "size": "50",
  "height": "500",
  "width": "800"
},

Was this article helpful?
Not really
Yes, Thanks

Can't find what you're looking for? Spot an error in the documentation? Get in touch with us on our Community Forum or using the feedback form above.