sanity-plugin-url-metadata-input

1.1.0 • Public • Published

sanity-plugin-url-metadata-input

URL input for Sanity that retrieves metadata (title, description) along with OpenGraph information.

Note: The resolving is done by an addon to the Sanity API and usage will at some point be an opt-in addon that is billed.

Screenshot

Installation

sanity install url-metadata-input

Usage

Use it in your schema types:

// [...]
{
  fields: [
    // [...]
    {
      name: 'relatedUrl',
      title: 'Related URL',
      type: 'urlWithMetadata',
    },
  ]
}

If you want the metadata below the URL field to be collapsed, set the collapsed option like so:

{
  name: 'relatedUrl',
  title: 'Related URL',
  type: 'urlWithMetadata',
  options: {
    collapsed: true,
  }
},

Data model

Note: Empty keys are not included

{
  _type: 'urlWithMetadata',

  // Raw user-input URL
  url: 'http://sanity.io',

  // Resolved URL after redirects
  resolvedUrl: 'https://sanity.io/',

  // Date when the metada resolving was performed
  crawledAt: '2017-09-01T09:48:35.501Z',

  // Basic metadata (from <head> of the page)
  meta: {
    title: 'Sanity – The fully customizable, headless CMS',
    description: 'Manage structured data collaboratively [...]'
  },

  // OpenGraph data (camelcased keys, eg `og:video:width` == `videoWidth`)
  // See http://ogp.me/ for more information
  openGraph: {
    title: '...',
    description: '...',
    siteName: '...',
    type: '...',
    url: '...',
    image: '...',
    imageAlt: '...',
    imageSecureUrl: '...',
    imageType: '...',
    imageHeight: '...',
    imageWidth: '...',
    audio: '...',
    audioSecureUrl: '...',
    audioType: '...',
    determiner: '...',
    locale: '...',
    video: '...',
    videoSecureUrl: '...',
    videoType: '...',
    videoHeight: '...',
    videoWidth: '...',
  }
}

License

MIT-licensed. See LICENSE.

/sanity-plugin-url-metadata-input/

    Package Sidebar

    Install

    npm i sanity-plugin-url-metadata-input

    Weekly Downloads

    4

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    123 kB

    Total Files

    14

    Last publish

    Collaborators

    • armandocerna
    • daniel.malmer
    • jordanl17
    • tambet
    • jtpetty
    • drewsanity
    • refiito
    • sergeisarviro
    • ash
    • indrek.karner
    • cngonzalez-sanity
    • rdunk
    • rneatherway-sanity
    • ricokahler
    • pedro-sanity
    • jonabc
    • kenjonespizza
    • pauloborgesf
    • binoy14
    • simen.svale
    • svirs
    • josh_sanity_io
    • joneidejohnsen
    • nina.andal
    • rankers
    • snorreeb
    • mattcraig
    • vincentquigley
    • stipsan
    • michael-sanity
    • rubioz
    • tonina
    • ritasdias
    • simeonsanity
    • kmelve
    • bjoerge
    • rexxars
    • skogsmaskin
    • robinpyon
    • mariuslundgard
    • sanity-io
    • evenw
    • radhe_sanity
    • rbotten
    • judofyr
    • obliadp
    • dcilke
    • fredcarlsen
    • hermanw
    • sgulseth
    • atombender
    • simenss